Last update Tue Dec 25 14:39:55 2012

dmagick.Image

License:
zlib (See accompanying LICENSE file)

Authors:
Mike Wey

alias dmagick.c.geometry.AffineMatrix AffineMatrix;

See Also:
dmagick.c.geometry.AffineMatrix

alias dmagick.c.image.AlphaChannelType AlphaChannelType;

See Also:
dmagick.c.image.AlphaChannelType

alias dmagick.c.magickType.ChannelType ChannelType;

See Also:
dmagick.c.magickType.ChannelType

alias dmagick.c.image.ChromaticityInfo ChromaticityInfo;

See Also:
dmagick.c.image.ChromaticityInfo

alias dmagick.c.magickType.ClassType ClassType;

See Also:
dmagick.c.magickType.ClassType

alias dmagick.c.colorspace.ColorspaceType ColorspaceType;

See Also:
dmagick.c.colorspace.ColorspaceType

alias dmagick.c.composite.CompositeOperator CompositeOperator;

See Also:
dmagick.c.composite.CompositeOperator

alias dmagick.c.compress.CompressionType CompressionType;

See Also:
dmagick.c.compress.CompressionType

alias dmagick.c.layer.DisposeType DisposeType;

See Also:
dmagick.c.layer.DisposeType

alias dmagick.c.distort.DistortImageMethod DistortImageMethod;

See Also:
dmagick.c.distort.DistortImageMethod

alias dmagick.c.quantum.EndianType EndianType;

See Also:
dmagick.c.quantum.EndianType

alias dmagick.c.resample.FilterTypes FilterTypes;

See Also:
dmagick.c.resample.FilterTypes

alias dmagick.c.geometry.GravityType GravityType;

See Also:
dmagick.c.geometry.GravityType

alias dmagick.c.image.ImageType ImageType;

See Also:
dmagick.c.image.ImageType

alias dmagick.c.image.InterlaceType InterlaceType;

See Also:
dmagick.c.image.InterlaceType

alias dmagick.c.pixel.InterpolatePixelMethod InterpolatePixelMethod;

See Also:
dmagick.c.pixel.InterpolatePixelMethod

alias dmagick.c.statistic.MagickEvaluateOperator MagickEvaluateOperator;

See Also:
dmagick.c.statistic.MagickEvaluateOperator

alias dmagick.c.statistic.MagickFunction MagickFunction;

See Also:
dmagick.c.statistic.MagickFunction

alias dmagick.c.fx.NoiseType NoiseType;

See Also:
dmagick.c.fx.NoiseType

alias dmagick.c.image.OrientationType OrientationType;

See Also:
dmagick.c.image.OrientationType

alias dmagick.c.effect.PreviewType PreviewType;

See Also:
dmagick.c.effect.PreviewType

alias ushort Quantum;

See Also:
dmagick.c.magickType.Quantum

alias dmagick.c.profile.RenderingIntent RenderingIntent;

See Also:
dmagick.c.profile.RenderingIntent

alias dmagick.c.image.ResolutionType ResolutionType;

See Also:
dmagick.c.image.ResolutionType

alias dmagick.c.distort.SparseColorMethod SparseColorMethod;

See Also:
dmagick.c.distort.SparseColorMethod

alias dmagick.c.statistic.StatisticType StatisticType;

See Also:
dmagick.c.effect.StatisticType

alias dmagick.c.constitute.StorageType StorageType;

See Also:
dmagick.c.constitute.StorageType

alias dmagick.c.draw.TypeMetric TypeMetric;

See Also:
dmagick.c.draw.TypeMetric

alias dmagick.c.cacheView.VirtualPixelMethod VirtualPixelMethod;

See Also:
dmagick.c.cacheView.VirtualPixelMethod

class Image;

The image

Options options;

The options for this image.

this();


this(string filename);

Construct an Image by reading from the file or URL specified by filename.

this(Geometry size, Color color);

Construct a blank image with the specified color.

this(void[] blob);
this(void[] blob, Geometry size);
this(void[] blob, Geometry size, size_t depth);
this(void[] blob, Geometry size, size_t depth, string magick);
this(void[] blob, Geometry size, string magick);

Construct an image from an in-memory blob. The Blob size, depth and magick format may also be specified.

Some image formats require size to be specified, the default depth Imagemagick uses is the Quantum size it's compiled with. If it doesn't match the depth of the image it may need to be specified.

Imagemagick can usualy detect the image format, when the format can't be detected a magick format must be specified.

this(size_t columns, size_t rows, string map, StorageType storage, void[] pixels);

Constructs an image from an array of pixels.

Parameters:

size_t columns The number of columns in the image.
size_t rows The number of rows in the image.
string map A string describing the expected ordering of the pixel array. It can be any combination or order of R = red, G = green, B = blue, A = alpha , C = cyan, Y = yellow, M = magenta, K = black, or I = intensity (for grayscale).
StorageType storage The pixel Staroage type (CharPixel, ShortPixel, IntegerPixel, FloatPixel, or DoublePixel).
void[] pixels The pixel data.

string toString();

Constructs a description of the image as a string. The string contains some or all of the following fields:

  • filename The current filename.
  • [scene] The scene number if the image is part of a secuence.
  • format The image format.
  • width x height
  • page width x height + xOffset + yOffset
  • classType DirectClass or PseudoClass
  • N-bit bit depth.
  • blob size if present.

void adaptiveBlur(double radius = 0, double sigma = 1, ChannelType channel = (ChannelType).DefaultChannels);

Adaptively blurs the image by blurring more intensely near image edges and less intensely far from edges. The adaptiveBlur method blurs the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and adaptiveBlur selects a suitable radius for you.

Parameters:

double radius The radius of the Gaussian in pixels, not counting the center pixel.
double sigma The standard deviation of the Laplacian, in pixels.
ChannelType channel The channels to blur.

void adaptiveResize(Geometry size);

adaptiveResize uses the special Mesh Interpolation method to resize images. Basically adaptiveResize avoids the excessive blurring that resize can produce with sharp color changes. This works well for slight image size adjustments and in particularly for magnification, And especially with images with sharp color changes. But when images are enlarged or reduced by more than 50% it will start to produce aliasing, and Moiré effects in the results.

void adaptiveSharpen(double radius = 0, double sigma = 1, ChannelType channel = (ChannelType).DefaultChannels);

Adaptively sharpens the image by sharpening more intensely near image edges and less intensely far from edges. The adaptiveSharpen method sharpens the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and adaptiveSharpen selects a suitable radius for you.

Parameters:

double radius The radius of the Gaussian in pixels, not counting the center pixel.
double sigma The standard deviation of the Laplacian, in pixels.
ChannelType channel If no channels are specified, sharpens all the channels.

void adaptiveThreshold(size_t width = 3, size_t height = 3, ssize_t offset = 0);

Selects an individual threshold for each pixel based on the range of intensity values in its local neighborhood. This allows for thresholding of an image whose global intensity histogram doesn't contain distinctive peaks.

Parameters:

size_t width define the width of the local neighborhood.
heigth define the height of the local neighborhood.
ssize_t offset constant to subtract from pixel neighborhood mean.

void addNoise(NoiseType type, ChannelType channel = (ChannelType).DefaultChannels);

Adds random noise to the specified channel or channels in the image. The amount of time addNoise requires depends on the NoiseType argument.

Parameters:

NoiseType type A NoiseType value.
ChannelType channel 0 or more ChannelType arguments. If no channels are specified, adds noise to all the channels

void affineTransform(AffineMatrix affine);

Transforms the image as specified by the affine matrix.

void annotate(string text, size_t xOffset, size_t yOffset, GravityType gravity = (GravityType).NorthWestGravity, double degrees = 0);

Annotates an image with text. Optionally you can include any of the following bits of information about the image by embedding the appropriate special characters:

     %b   file size in bytes.
     %c   comment.
     %d   directory in which the image resides.
     %e   extension of the image file.
     %f   original filename of the image.
     %h   height of image.
     %i   filename of the image.
     %k   number of unique colors.
     %l   image label.
     %m   image file format.
     %n   number of images in a image sequence.
     %o   output image filename.
     %p   page number of the image.
     %q   image depth (8 or 16).
     %q   image depth (8 or 16).
     %s   image scene number.
     %t   image filename without any extension.
     %u   a unique temporary filename.
     %w   image width.
     %x   x resolution of the image.
     %y   y resolution of the image.

Parameters:

string text The text.
size_t xOffset The x coordinate.
size_t yOffset The y coordinate.
GravityType gravity Placement gravity.
double degrees The angle of the Text.

void annotate(string text, Geometry boundingArea = (Geometry).init, GravityType gravity = (GravityType).NorthWestGravity, double degrees = 0);

Ditto, but word wraps the text so it stays withing the boundingArea. if the height and width are 0 the height and with of the image are used to calculate the bounding area.

void autoGamma(ChannelType channel = (ChannelType).DefaultChannels);

extract the 'mean' from the image and adjust the image to try make set its gamma appropriatally.

Parameters:

ChannelType channel One or more channels to adjust.

void autoLevel(ChannelType channel = (ChannelType).DefaultChannels);

adjusts the levels of a particular image channel by scaling the minimum and maximum values to the full quantum range.

Parameters:

ChannelType channel One or more channels to adjust.

void bilevel(Quantum threshold, ChannelType channel = (ChannelType).DefaultChannels);

Changes the value of individual pixels based on the intensity of each pixel channel. The result is a high-contrast image.

More precisely each channel value of the image is 'thresholded' so that if it is equal to or less than the given value it is set to zero, while any value greater than that give is set to it maximum or QuantumRange.

Parameters:

Quantum threshold The threshold value.
ChannelType channel One or more channels to adjust.

void blackThreshold(Quantum threshold, ChannelType channel = (ChannelType).DefaultChannels);
void blackThreshold(Quantum red, Quantum green, Quantum blue, Quantum opacity = 0, ChannelType channel = (ChannelType).DefaultChannels);

Forces all pixels below the threshold into black while leaving all pixels above the threshold unchanged.

Parameters:

Quantum threshold The threshold value for red green and blue.
ChannelType channel One or more channels to adjust.

void blend(const(Image) overlay, int srcPercentage, int dstPercentage, ssize_t xOffset, ssize_t yOffset);
void blend(const(Image) overlay, int srcPercentage, int dstPercentage, GravityType gravity = (GravityType).NorthWestGravity);

Adds the overlay image to the target image according to srcPercent and dstPercent.

This method corresponds to the -blend option of ImageMagick's composite command.

Parameters:

const(Image) overlay The source image for the composite operation.
int srcPercentage Percentage for the source image.
int dstPercentage Percentage for this image.
ssize_t xOffset The x offset to use for the overlay.
ssize_t yOffset The y offset to use for the overlay.
gravity The gravity to use for the overlay.

void blueShift(double factor = 1.5);

mutes the colors of the image to simulate a scene at nighttime in the moonlight.

Parameters:

double factor The shift factor, larger values increase the effect.

void blur(double radius = 0, double sigma = 1, ChannelType channel = (ChannelType).DefaultChannels);

Blurs the specified channel. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). The blur method differs from gaussianBlur in that it uses a separable kernel which is faster but mathematically equivalent to the non-separable kernel.

Parameters:

double radius The radius of the Gaussian in pixels, not counting the center pixel.
double sigma The standard deviation of the Laplacian, in pixels.
ChannelType channel The channels to blur.

void border(size_t width, size_t height);

Surrounds the image with a border of the color defined by the borderColor property.

Parameters:

size_t width Border width in pixels.
size_t height Border height in pixels.

const Image channel(ChannelType channel);

Extract channel from image. Use this option to extract a particular channel from the image. ChannelType.MatteChannel for example, is useful for extracting the opacity values from an image.

void charcoal(double radius = 0, double sigma = 1);

Adds a "charcoal" effect to the image. You can alter the intensity of the effect by changing the radius and sigma arguments.

Parameters:

double radius The radius of the pixel neighborhood.
double sigma The standard deviation of the Gaussian, in pixels.

void chop(Geometry geometry);

Removes the specified rectangle and collapses the rest of the image to fill the removed portion.

Parameters:

Geometry geometry The horizontal and/or vertical subregion to remove.

const Image clone();

Returns a copy of the image.

void clut(Image clutImage, ChannelType channel = (ChannelType).DefaultChannels);

replaces each color value in the given image, by using it as an index to lookup a replacement color value in a Color Look UP Table in the form of an image. The values are extracted along a diagonal of the CLUT image so either a horizontal or vertial gradient image can be used.

Typically this is used to either re-color a gray-scale image according to a color gradient in the CLUT image, or to perform a freeform histogram (level) adjustment according to the (typically gray-scale) gradient in the CLUT image.

When the 'channel' mask includes the matte/alpha transparency channel but one image has no such channel it is assumed that that image is a simple gray-scale image that will effect the alpha channel values, either for gray-scale coloring (with transparent or semi-transparent colors), or a histogram adjustment of existing alpha channel values. If both images have matte channels, direct and normal indexing is applied, which is rarely used.

Parameters:

Image clutImage the color lookup table image for replacement color values.
ChannelType channel One or more channels to adjust.

void colorDecisionList(string colorCorrectionCollection);

Applies a lightweight Color Correction Collection (CCC) file to the image. The file solely contains one or more color corrections. Here is a sample:

 <ColorCorrectionCollection xmlns="urn:ASC:CDL:v1.2">
     <ColorCorrection id="cc03345">
         <SOPNode>
             <Slope> 0.9 1.2 0.5 </Slope>
             <Offset> 0.4 -0.5 0.6 </Offset>
             <Power> 1.0 0.8 1.5 </Power>
         </SOPNode>
         <SATNode>
             <Saturation> 0.85 </Saturation>
         </SATNode>
     </ColorCorrection>
 </ColorCorrectionCollection>
which includes the slop, offset, and power for each of the RGB channels as well as the saturation.

See Also:
Wikipedia ASC CDL.

void colorize(Color fill, uint opacityRed, uint opacityGreen, uint opacityBlue, uint opacityAlpha = 0);

Blend the fill color with the image pixels. The opacityRed, opacityGreen, opacityBlue and opacityAlpha arguments are the percentage to blend with the red, green, blue and alpha channels.

void colorMatrix(double[][] matrix);

Applies color transformation to an image. This method permits saturation changes, hue rotation, luminance to alpha, and various other effects. Although variable-sized transformation matrices can be used, typically one uses a 5x5 matrix for an RGBA image and a 6x6 for CMYKA (or RGBA with offsets). The matrix is similar to those used by Adobe Flash except offsets are in column 6 rather than 5 (in support of CMYKA images) and offsets are normalized (divide Flash offset by 255)

Parameters:

double[][] matrix A tranformation matrix, with a maximum size of 6x6.

bool compare(const(Image) referenceImage);

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.

void composite(const(Image) overlay, CompositeOperator compositeOp, ssize_t xOffset, ssize_t yOffset, ChannelType channel = (ChannelType).DefaultChannels);
void composite(const(Image) overlay, CompositeOperator compositeOp, GravityType gravity = (GravityType).NorthWestGravity, ChannelType channel = (ChannelType).DefaultChannels);

Composites dest onto this image using the specified composite operator.

Parameters:

const(Image) overlay Image to use in the composite operation.
CompositeOperator compositeOp The composite operation to use.
ssize_t xOffset The x-offset of the composited image, measured from the upper-left corner of the image.
ssize_t yOffset The y-offset of the composited image, measured from the upper-left corner of the image.
gravity The gravity that defines the location of the location of overlay.
ChannelType channel One or more channels to compose.

void composite(const(Image) overlay, double a, double b, double c, double d, ssize_t xOffset, ssize_t yOffset, ChannelType channel = (ChannelType).DefaultChannels);
void composite(const(Image) overlay, double a, double b, double c, double d, GravityType gravity = (GravityType).NorthWestGravity, ChannelType channel = (ChannelType).DefaultChannels);

Merge the source and destination images according to the formula a*Sc*Dc + b*Sc + c*Dc + d where Sc is the source pixel and Dc is the destination pixel.

Parameters:

const(Image) overlay Image to use in to composite operation.
ssize_t xOffset The x-offset of the composited image, measured from the upper-left corner of the image.
ssize_t yOffset The y-offset of the composited image, measured from the upper-left corner of the image.
gravity The gravity that defines the location of the location of overlay.
ChannelType channel One or more channels to compose.

void compositeTiled(const(Image) overlay, CompositeOperator compositeOp, ChannelType channel = (ChannelType).DefaultChannels);

Composites multiple copies of the source image across and down the image, producing the same results as ImageMagick's composite command with the -tile option.

Parameters:

const(Image) overlay Image to use in to composite operation.
CompositeOperator compositeOp The composite operation to use.
ChannelType channel One or more channels to compose.

void contrast(bool sharpen = false);

enhances the intensity differences between the lighter and darker elements of the image.

Parameters:

bool sharpen If true increases the image contrast otherwise the contrast is reduced.

void contrastStretch(double blackPoint, double whitePoint, ChannelType channel = (ChannelType).DefaultChannels);

This is a simple image enhancement technique that attempts to improve the contrast in an image by `stretching' the range of intensity values it contains to span a desired range of values. It differs from the more sophisticated histogram equalization in that it can only apply a linear scaling function to the image pixel values. As a result the `enhancement' is less harsh.

Parameters:

double blackPoint Black out at most this many pixels. Specify an apsulute number of pixels or an percentage by passing a value between 1 and 0
double whitePoint Burn at most this many pixels. Specify an apsulute number of pixels or an percentage by passing a value between 1 and 0
ChannelType channel One or more channels to adjust.

void convolve(double[][] matrix, ChannelType channel = (ChannelType).DefaultChannels);

Applies a custom convolution kernel to the image.

See Also:
Convolution in the Hypermedia Image Processing Reference.

void crop(Geometry geometry);

Extract a region of the image starting at the offset defined by geometry. Region must be fully defined, and no special handling of geometry flags is performed.

void cycleColormap(ssize_t amount);

displaces an image's colormap by a given number of positions. If you cycle the colormap a number of times you can produce a psychodelic effect.

void decipher(string passphrase);

Decipher an enciphered image.

void deskew(double threshold = 0.4, size_t autoCropWidth = 0);

Straightens an image. A threshold of 40% works for most images.

Skew is an artifact that occurs in scanned images because of the camera being misaligned, imperfections in the scanning or surface, or simply because the paper was not placed completely flat when scanned.

Parameters:

double threshold Specify an apsulute number of pixels or an percentage by passing a value between 1 and 0.
size_t autoCropWidth Specify a value for this argument to cause the deskewed image to be auto-cropped. The argument is the pixel width of the image background (e.g. 40). A width of 0 disables auto cropping.

void despeckle();

Reduces the speckle noise in an image while perserving the edges of the original image.

void displace(const(Image) displacementMap, int xAmplitude, int yAmplitude, ssize_t xOffset, ssize_t yOffset);
void displace(const(Image) overlay, int srcPercentage, int dstPercentage, GravityType gravity = (GravityType).NorthWestGravity);

Uses displacementMap to move color from img to the output image.

This method corresponds to the -displace option of ImageMagick's composite command.

Parameters:

const(Image) displacementMap

The source image for the composite operation.
int xAmplitude The maximum displacement on the x-axis.
int yAmplitude The maximum displacement on the y-axis.
ssize_t xOffset The x offset to use.
ssize_t yOffset The y offset to use.
gravity The gravity to use.

void display();

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.

void dissolve(const(Image) overlay, int srcPercentage, int dstPercentage, ssize_t xOffset, ssize_t yOffset);
void dissolve(const(Image) overlay, int srcPercentage, int dstPercentage, GravityType gravity = (GravityType).NorthWestGravity);

Composites the overlay image onto this image. The opacity of this image is multiplied by dstPercentage and opacity of overlay is multiplied by srcPercentage.

This method corresponds to the -dissolve option of ImageMagick's composite command.

Parameters:

const(Image) overlay The source image for the composite operation.
int srcPercentage Percentage for the source image.
int dstPercentage Percentage for this image.
ssize_t xOffset The x offset to use for the overlay.
ssize_t yOffset The y offset to use for the overlay.
gravity The gravity to use for the overlay.

void distort(DistortImageMethod method, double[] arguments, bool bestfit = false);

Distort an image using the specified distortion type and its required arguments. This method is equivalent to ImageMagick's -distort option.

Parameters:

DistortImageMethod method Distortion method to use.
double[] arguments An array of numbers. The size of the array depends on the distortion type.
bool bestfit If enabled, and the distortion allows it, the destination image is adjusted to ensure the whole source image will just fit within the final destination image, which will be sized and offset accordingly.

void edge(double radius = 0);

Finds edges in an image.

Parameters:

double radius the radius of the convolution filter. If 0 a suitable default is selected.

void emboss(double radius = 0, double sigma = 1);

Emboss image (hilight edges with 3D effect).

Parameters:

double radius The radius of the Gaussian, in pixels, not counting the center pixel.
double sigma The standard deviation of the Laplacian, in pixels.

void encipher(string passphrase);

Encipher an image.

void enhance();

Applies a digital filter that improves the quality of a noisy image.

void equalize(ChannelType channel = (ChannelType).DefaultChannels);

Applies a histogram equalization to the image.

void erase();

Initializes the image pixels to the image background color.

void evaluate(MagickEvaluateOperator op, double value, ChannelType channel = (ChannelType).DefaultChannels);

Applies a value to the image with an arithmetic, relational, or logical operator to an image. Use these operations to lighten or darken an image, to increase or decrease contrast in an image, or to produce the "negative" of an image.

See Also:
ImageMagick's -evaluate option.

void excerpt(Geometry geometry);

This method is very similar to crop. It extracts the rectangle specified by its arguments from the image and returns it as a new image. However, excerpt does not respect the virtual page offset and does not update the page offset and is more efficient than cropping.

It is the caller's responsibility to ensure that the rectangle lies entirely within the original image.

const T[] exportPixels(T)(Geometry area, string map = "RGBA");

Extracts the pixel data from the specified rectangle.

Parameters:

area Area 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.

Returns:
An array of values containing the pixel components as defined by the map parameter and the Type.

const void exportPixels(T)(Geometry area, T[] pixels, string map = "RGBA");

Ditto, but takes an existing pixel buffer.

Throws:
An ImageException if the buffer length is insufficient.

void extent(Geometry geometry);

If the Geometry is larger than this Image, extends the image to the specified geometry. And the new pixels are set to the background color. If the Geometry is smaller than this image crops the image.

The new image is composed over the background using the composite operator specified by the compose property.

Geometry findSimilarRegion(Image target, ssize_t xOffset, ssize_t yOffset);

This interesting method searches for a rectangle in the image that is similar to the target. For the rectangle to be similar each pixel in the rectangle must match the corresponding pixel in the target image within the range specified by the fuzz property of this image and the target image.

Parameters:

Image target An image that forms the target of the search.
ssize_t xOffset The starting x position to search for a match.
ssize_t yOffset The starting y position to search for a match.

Returns:
The size and location of the match.

void flip();

creates a vertical mirror image by reflecting the pixels around the central x-axis.

void floodFill(ssize_t xOffset, ssize_t yOffset, bool fillToBorder = false, ChannelType channel = (ChannelType).DefaultChannels);

Changes the color value of any pixel that matches target and is an immediate neighbor. To the fillColor or fillPattern set for this image. If fillToBorder is true, the color value is changed for any neighbor pixel that does not match the borderColor.

By default target must match a particular pixel color exactly. However, in many cases two colors may differ by a small amount. The fuzz property of image defines how much tolerance is acceptable to consider two colors as the same. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color for the purposes of the floodfill.

Parameters:

ssize_t xOffset Starting x location for the operation.
ssize_t xOffset Starting y location for the operation.
bool fillToBorder If true fill untill the borderColor, else only the target color if affected.
ChannelType channel The affected channels.

void floodFillColor(ssize_t xOffset, ssize_t yOffset, Color fillColor, Color borderColor = null, ChannelType channel = (ChannelType).DefaultChannels);

Fill the image like floodFill but use the specified colors.

Parameters:

ssize_t xOffset Starting x location for the operation.
ssize_t xOffset Starting y location for the operation.
Color fillColor Fill color to use.
Color borderColor borderColor to use.
ChannelType channel The affected channels.

void floodFillPattern(ssize_t xOffset, ssize_t yOffset, Image fillPattern, Color borderColor = null, ChannelType channel = (ChannelType).DefaultChannels);

Fill the image like floodFill but use the specified pattern an borderColor.

Parameters:

ssize_t xOffset Starting x location for the operation.
ssize_t xOffset Starting y location for the operation.
Image fillPattern Fill pattern to use.
Color borderColor borderColor to use.
ChannelType channel The affected channels.

void flop();

creates a horizontal mirror image by reflecting the pixels around the central y-axis.

void frame(Geometry geometry);

Adds a simulated 3D border. The matteColor is used to draw the frame.

Parameters:

Geometry geometry The size portion indicates the width and height of the frame. If no offsets are given then the border added is a solid color. Offsets x and y, if present, specify that the width and height of the border is partitioned to form an outer bevel of thickness x pixels and an inner bevel of thickness y pixels. Negative offsets make no sense as frame arguments.

void functionImage(MagickFunction funct, double[] params, ChannelType channel = (ChannelType).DefaultChannels);

Applies a value to the image with an arithmetic, relational, or logical operator to an image. Use these operations to lighten or darken an image, to increase or decrease contrast in an image, or to produce the "negative" of an image.

This method is equivalent to the convert -function option.

Parameters:

function The MagickFunction to use.
double[] params

An array of values to be used by the function.
  • PolynomialFunction: The Polynomial function takes an arbitrary number of parameters, these being the coefficients of a polynomial, in decreasing order of degree. That is, entering [aₙ, aₙ₋₁, ... a₁, a₀] will invoke a polynomial function given by: aₙ uⁿ + aₙ₋₁ uⁿ⁻¹ + ··· a₁ u + a₀, where where u is pixel's original normalized channel value.
  • SinusoidFunction: These values are given as one to four parameters, as follows, [freq, phase, amp, bias] if omitted the default values will be used: [1.0, 0.0, 0.5, 0.5].
  • ArcsinFunction: These values are given as one to four parameters, as follows, [width, center, range, bias] if omitted the default values will be used: [1.0, 0.5, 1.0, 0.5].
  • ArctanFunction: These values are given as one to four parameters, as follows, [slope, center, range, bias] if omitted the default values will be used: [1.0, 0.5, 1.0, 0.5].
ChannelType channel The channels this funtion aplies to.

void fx(string expression, ChannelType channel = (ChannelType).DefaultChannels);

Applies a mathematical expression to the specified image.

See Aso:

FX, The Special Effects Image Operator for a detailed discussion of this option.

void gamma(double value, ChannelType channel = (ChannelType).DefaultChannels);
void gamma(double red, double green, double blue);

gamma gamma-corrects a particular image channel. The same image viewed on different devices will have perceptual differences in the way the image's intensities are represented on the screen. Specify individual gamma levels for the red, green, and blue channels, or adjust all three with the gamma function. Values typically range from 0.8 to 2.3.

You can also reduce the influence of a particular channel with a gamma value of 0.

void gaussianBlur(double radius = 0, double sigma = 1, ChannelType channel = (ChannelType).DefaultChannels);

Blurs an image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, the radius should be larger than sigma.

Parameters:

double radius The radius of the Gaussian, in pixels, not counting the center pixel.
double sigma the standard deviation of the Gaussian, in pixels.
ChannelType channel The channels to blur.

TypeMetric getTypeMetrics(string text);

Returns the TypeMetric class witch provides the 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:

 sizePoints = (sizePixels * 72)/resolution
where resolution is in dots-per-inch (DPI). This means that at the default image resolution, there is one pixel per point.

See Also:
FreeType Glyph Conventions for a detailed description of font metrics related issues.

void haldClut(Image haldImage, ChannelType channel = (ChannelType).DefaultChannels);

applies a Hald color lookup table to the image. A Hald color lookup table is a 3-dimensional color cube mapped to 2 dimensions. Create it with the HALD coder. You can apply any color transformation to the Hald image and then use this method to apply the transform to the image.

Parameters:

Image haldImage The image, which is replaced by indexed CLUT values.
ChannelType channel The channels to aply the CLUT to.

See Also:
dmagick.Image.clut which provides color value replacement of the individual color channels, usally involving a simplier gray-scale image. E.g: gray-scale to color replacement, or modification by a histogram mapping.

void implode(double amount = 0.5);

A funhouse mirror effect.

Parameters:

double amount Defines the extend of the effect. The value may be positive for implosion, or negative for explosion.

void importPixels(T)(Geometry area, T[] pixels, string map = "RGBA");

Replaces the pixels in the specified area with pixel data from the supplied array.

Parameters:

area Location in the image to store the pixels.
pixels An array of pixels defined by map.
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.

void level(Quantum blackPoint = 0, Quantum whitePoint = QuantumRange, double gamma = 1, ChannelType channel = (ChannelType).DefaultChannels);

Adjusts the levels of an 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, and white points. Colors darker than the black point are set to zero. Colors brighter than the white point are set to the maximum quantum value.

It is typically used to improve image contrast, or to provide a controlled linear threshold for the image. If the black and white points are set to the minimum and maximum values found in the image, the image can be normalized. or by swapping black and white values, negate the image.

Parameters:

Quantum blackPoint Specifies the darkest color in the image.
Quantum whitePoint Specifies the lightest color in the image.
double gamma Specifies the gamma correction to apply to the image.
ChannelType channel The channels to level.

void levelize(Quantum blackPoint = 0, Quantum whitePoint = QuantumRange, double gamma = 1, ChannelType channel = (ChannelType).DefaultChannels);

applies the reversed level operation to just the channels specified. It compresses the full range of color values, so that they lie between the given black and white points. Gamma is applied before the values are mapped.

It can be used for example de-contrast a greyscale image to the exact levels specified. Or by using specific levels for each channel of an image you can convert a gray-scale image to any linear color gradient, according to those levels.

Parameters:

Quantum blackPoint Specifies the darkest color in the image.
Quantum whitePoint Specifies the lightest color in the image.
double gamma Specifies the gamma correction to apply to the image.
ChannelType channel The channels to level.

void linearStretch(Quantum blackPoint, Quantum whitePoint);

Discards any pixels below the black point and above the white point and levels the remaining pixels.

Parameters:

Quantum blackPoint Specifies the darkest color in the image.
Quantum whitePoint Specifies the lightest color in the image.

void liquidRescale(Geometry size, size_t rows, double deltaX = 0, double rigidity = 0);

Rescale image with seam carving. To use this method, you must have installed and configured ImageMagick to use the Liquid Rescale Library.

Parameters:

columns The desired width.
size_t rows The desired height.
double deltaX Maximum seam transversal step (0 means straight seams).
double rigidity Introduce a bias for non-straight seams (typically 0).

void magnify();

A convenience method that scales an image proportionally to twice its size.

void medianFilter(size_t radius = 0);

Applies a digital filter that improves the quality of a noisy image. Each pixel is replaced by the median in a set of neighboring pixels as defined by radius.

Parameters:

size_t radius The filter radius. Values larger than 8 or 9 may take longer than you want to wait, and will not have significantly better results than much smaller values.

void minify();

A convenience method that scales an image proportionally to half its size.

void modulate(double brightness = 1, double saturation = 1, double hue = 1);

Modulate percent hue, saturation, and brightness of an image. Modulation of saturation and brightness is as a ratio of the current value (1 ( == 100% ) for no change).

Parameters:

double brightness The percentage of change in the brightness.
double saturation The percentage of change in the saturation.
double hue The percentage of change in the hue.

void motionBlur(double radius = 0, double sigma = 1, double angle = 0, ChannelType channel = (ChannelType).DefaultChannels);

Simulates motion blur. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). Use a radius of 0 and motion_blur selects a suitable radius for you. Angle gives the angle of the blurring motion.

Parameters:

double radius The radius of the Gaussian operator.
double sigma The standard deviation of the Gaussian operator. Must be non-0.
double angle The angle (in degrees) of the blurring motion.
ChannelType channel The affected channels.

void negate(bool grayscale = false, ChannelType channel = (ChannelType).DefaultChannels);

Negates the colors in the reference image.

Parameters:

bool grayscale If true, only negate grayscale pixels within the image.
ChannelType channel The affected channels.

void normalize(ChannelType channel = (ChannelType).DefaultChannels);

Enhances the contrast of a color image by adjusting the pixel color to span the entire range of colors available.

void oilPaint(double radius = 3);

Applies a special effect filter that simulates an oil painting. Each pixel is replaced by the most frequent color occurring in a circular region defined by radius.

void opacity(Quantum value);

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.

void opaque(Color target, Color fill, bool invert = false, ChannelType channel = (ChannelType).CompositeChannels);

Changes all pixels having the target color to the fill color.

Parameters:

Color target The color to be replaced.
Color fill The replacement color.
bool invert If true, the target pixels are all the pixels that are not the target color.
ChannelType channel The affected channels.

void orderedDither(string map);

Dithers the image to a predefined pattern.

Parameters:

string map The map argument can be any of the strings listed by this command:
           convert -list Threshold

See Also:
ImageMagick's -ordered-dither option.

void ping(string filename);
void ping(void[] blob);

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.

void polaroid(double angle);

Produce an image that looks like a Polaroid® instant picture. If the image has a "Caption" property, the value is used as a caption.

Parameters:

double angle The resulting image is rotated by this amount, measured in degrees.

void posterize(size_t levels = 4, bool dither = false);

Reduces the image to a limited number of colors for a "poster" effect.

Parameters:

size_t levels Number of color levels allowed in each channel. Very low values (2, 3, or 4) have the most visible effect.
bool dither If true, dither the image.

Image preview(PreviewType preview);

Creates an image that contains 9 small versions of the receiver image. The center image is the unchanged receiver. The other 8 images are variations created by transforming the receiver according to the specified preview type with varying parameters.

A preview image is an easy way to "try out" a transformation method.

void process(string name, string[] arguments);

Execute the named process module, passing any arguments arguments. An exception is thrown if the requested process module does not exist, fails to load, or fails during execution.

Parameters:

string name The name of a module.
string[] arguments The arguments to pass to the module.

void quantize(bool measureError = false);

Analyzes the colors within a reference image and chooses a fixed number of colors to represent the image. The goal of the algorithm is to minimize the difference between the input and output image while minimizing the processing time.

Parameters:

bool measureError Set to true to calculate quantization errors when quantizing the image. These can be accessed

with:

normalizedMeanError, normalizedMaxError and meanErrorPerPixel.

void radialBlur(double angle, ChannelType channel = (ChannelType).DefaultChannels);

Applies a radial blur to the image.

Parameters:

double angle The angle of the radial blur, in degrees.
ChannelType channel If no channels are specified, blurs all the channels.

void raise(size_t width, size_t height, bool raised = true);

Creates a simulated three-dimensional button-like effect by lightening and darkening the edges of the image.

Parameters:

size_t width The width of the raised edge in pixels.
size_t height The height of the raised edge in pixels.
bool raised If true, the image is raised, otherwise lowered.

void randomThreshold(Geometry thresholds, ChannelType channel = (ChannelType).DefaultChannels);

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.

Parameters:

Geometry thresholds A geometry string containing LOWxHIGH thresholds. The string is in the form `XxY'. The Y value may be omitted, in which case it is assigned the value QuantumRange-X. If an % appears in the string then the values are assumed to be percentages of QuantumRange. If the string contains 2x2, 3x3, or 4x4, then an ordered dither of order 2, 3, or 4 will be performed instead.
ChannelType channel The affected channels.

void read(string filename);

Read an Image by reading from the file or URL specified by filename.

void read(string filename, Geometry size);

Read an Image by reading from the file or URL specified by filename with the specified size. Usefull for images that don't specify their size.

void read(void[] blob);
void read(void[] blob, Geometry size);
void read(void[] blob, Geometry size, size_t depth);
void read(void[] blob, Geometry size, size_t depth, string magick);
void read(void[] blob, Geometry size, string magick);

Reads an image from an in-memory blob. The Blob size, depth and magick format may also be specified.

Some image formats require size to be specified, the default depth Imagemagick uses is the Quantum size it's compiled with. If it doesn't match the depth of the image it may need to be specified.

Imagemagick can usualy detect the image format, when the format can't be detected a magick format must be specified.

void readPixels(T)(size_t width, size_t height, string map, T[] pixels);

Reads an image from an array of pixels.

Parameters:

width The number of columns in the image.
height The number of rows in the image.
map A string describing the expected ordering of the pixel array. It can be any combination or order of R = red, G = green, B = blue, A = alpha , C = cyan, Y = yellow, M = magenta, K = black, or I = intensity (for grayscale).
storage The pixel Staroage type (CharPixel, ShortPixel, IntegerPixel, FloatPixel, or DoublePixel).
pixels The pixel data.

BUGS:
DMD bug 2972 prevents readpixels from being named just read.

void reduceNoise(size_t radius = 0);

Smooths the contours of an image while still preserving edge information. The algorithm works by replacing each pixel with its neighbor closest in value.

Parameters:

size_t radius A neighbor is defined by radius. Use a radius of 0 and reduceNoise selects a suitable radius for you.

void remap(Image reference);

Reduce the number of colors in img to the colors used by reference. If a dither method is set then the given colors are dithered over the image as necessary, otherwise the closest color (in RGB colorspace) is selected to replace that pixel in the image.

void resample(double xResolution, double yResolution, FilterTypes filter = (FilterTypes).LanczosFilter, double blur = 1);

Resize image in terms of its pixel size, so that when displayed at the given resolution it will be the same size in terms of real world units as the original image at the original resolution.

Parameters:

double xResolution the target horizontal resolution
double yResolution the target vertical resolution
FilterTypes filter The filter to use when resizing.
double blur Values > 1 increase the blurriness. Values < 1 increase the sharpness.

void resize(Geometry size, FilterTypes filter = (FilterTypes).LanczosFilter, double blur = 1);

scales an image to the desired dimensions, using the given filter.

Parameters:

Geometry size The desired width and height.
FilterTypes filter The filter to use when resizing.
double blur Values > 1 increase the blurriness. Values < 1 increase the sharpness.

void roll(ssize_t xOffset, ssize_t yOffset);

Offsets an image as defined by xOffset and yOffset.

void rotate(double degrees);

Rotate the image by specified number of degrees. Rotated images are usually larger than the originals and have 'empty' triangular corners. Empty triangles left over from shearing the image are filled with the background color defined by the 'backgroundColor' property of the image.

Parameters:

double degrees The number of degrees to rotate the image. Positive angles rotate counter-clockwise (right-hand rule), while negative angles rotate clockwise.

void sample(Geometry size);

scales an image to the desired dimensions with pixel sampling. Unlike other scaling methods, this method does not introduce any additional color into the scaled image.

void scale(Geometry size);

Resize image by using simple ratio algorithm.

void segment(double clusterThreshold = 1, double smoothingThreshold = 1.5);

Segments an image 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 properties.

Parameters:

double clusterThreshold

The number of pixels in each cluster must exceed the the cluster threshold to be considered valid.
double smoothingThreshold

The smoothing threshold eliminates noise in the second derivative of the histogram. As the value is increased, you can expect a smoother second derivative.

void selectiveBlur(double radius, double sigma, double threshold, ChannelType channel = (ChannelType).DefaultChannels);

Selectively blur pixels within a contrast threshold.

Parameters:

double radius The radius of the Gaussian in pixels, not counting the center pixel.
double sigma The standard deviation of the Laplacian, in pixels.
double threshold Threshold level represented as a percentage of the quantum range.
ChannelType channel The channels to blur.

void sepiatone(double threshold = QuantumRange);

applies a special effect to the image, similar to the effect achieved in a photo darkroom by sepia toning. A threshold of 80% is a good starting point for a reasonable tone.

Parameters:

double threshold Threshold ranges from 0 to QuantumRange and is a measure of the extent of the sepia toning. A value lower than 1 is treated as a percentage.

void shade(double azimuth = 30, double elevation = 30, bool shading = false);

shines a distant light on an image to create a three-dimensional effect. You control the positioning of the light with azimuth and elevation.

Parameters:

double azimuth The amount of degrees off the X axis.
double elevation The amount of pixels above the Z axis.
bool shading If true, shade shades the intensity of each pixel.

Image shadowImage(ssize_t xOffset, ssize_t yOffset, double sigma = 4, double opacity = 1);

Simulates a shadow from the specified image and returns it. This method only works when the image has opaque parts and transparent parts. Note that the resulting image is just the shadow.

Parameters:

ssize_t xOffset The shadow x offset.
ssize_t yOffset The shadow y offset.
double sigma The standard deviation of the Gaussian operator used to produce the shadow. The higher the number, the "blurrier" the shadow, but the longer it takes to produce the shadow.
double opacity The percent opacity of the shadow. A number between 0.1 and 1.0

Returns:
The shadows for this image.

void sharpen(double radius = 0, double sigma = 1, ChannelType channel = (ChannelType).DefaultChannels);

Sharpens an image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and sharpen selects a suitable radius for you.

Parameters:

double radius The radius of the Gaussian in pixels, not counting the center pixel.
double sigma The standard deviation of the Laplacian, in pixels.
ChannelType channel If no channels are specified, sharpens all the channels.

void shave(Geometry geometry);

Removes pixels from the edges of the image, leaving the center rectangle.

Parameters:

Geometry geometry The region of the image to crop.

void shear(double xShearAngle, double yShearAngle);

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, xShearAngle is measured relative to the Y axis, and similarly, for Y direction shears yShearAngle is measured relative to the X axis. Empty triangles left over from shearing the image are filled with the background color.

void sigmoidalContrast(double contrast = 3, double midpoint = 50, bool sharpen = false, ChannelType channel = (ChannelType).DefaultChannels);

Adjusts the contrast of an image channel with a non-linear sigmoidal contrast algorithm. Increases the contrast of the image using a sigmoidal transfer function without saturating highlights or shadows.

Parameters:

double contrast indicates how much to increase the contrast (0 is none; 3 is typical; 20 is pushing it)
double midpoint indicates where midtones fall in the resultant image (0 is white; 50% is middle-gray; 100% is black). Specify an apsulute number of pixels or an percentage by passing a value between 1 and 0
bool sharpen Increase or decrease image contrast.
ChannelType channel The channels to adjust.

void sketch(double radius = 0, double sigma = 1, double angle = 0);

Simulates a pencil sketch. For best results start with a grayscale image.

Parameters:

double radius The radius of the Gaussian, in pixels, not counting the center pixel.
double sigma The standard deviation of the Gaussian, in pixels.
double angle The angle toward which the image is sketched.

void solarize(Quantum threshold, ChannelType channel = (ChannelType).DefaultChannels);

Applies a special effect to the image similar to the effect achieved in a photo darkroom by selectively exposing areas of photo sensitive paper to light.

Parameters:

Quantum threshold The extent of the solarization.
ChannelType channel The channels to adjust. Anything other than ChannelType.DefaultChannels requires ImageMagick 6.8.0 ot higher.

void sparseColor(SparseColorMethod method, Tuple!(ulong,"x",ulong,"y",Color,"color")[] args...);

Fills the image with the specified color or colors, starting at the x,y coordinates associated with the color and using the specified interpolation method.

Parameters:

SparseColorMethod method The method to fill in the gradient between the control points.
Tuple!(ulong,"x",ulong,"y",Color,"color")[] args A series of control points, and there Color.

See Also:
Sparse Points of Color at Examples of ImageMagick Usage.

void splice(Geometry geometry);

Splice the background color into the image as defined by the geometry. This method is the opposite of chop.

void spread(double radius = 3);

Randomly displaces each pixel in a block defined by the radius parameter.

void statistic()(StatisticType type, size_t width, size_t height);

Makes each pixel the min / max / median / mode / etc. of the neighborhood of the specified width and height.

Parameters:

type The type pf statistic to apply.
width The width of the pixel neighborhood.
height The height of the pixel neighborhood.

void stegano(Image watermark, ssize_t offset);

Hides a digital watermark in the receiver. You can retrieve the watermark by reading the file with the stegano: prefix, thereby proving the authenticity of the file.

The watermarked image must be saved in a lossless RGB format such as MIFF, or PNG. You cannot save a watermarked image in a lossy format such as JPEG or a pseudocolor format such as GIF. Once written, the file must not be modified or processed in any way.

Parameters:

Image watermark An image or imagelist to be used as the watermark. The watermark must be grayscale and should be substantially smaller than the receiver. The recovery time is proportional to the size of the watermark.
ssize_t offset The starting position within the receiver at which the watermark will be hidden. When you retrieve the watermark from the file, you must supply this value, along with the width and height of the watermark, in the size optional parameter to the read method.

void stereo(Image rightImage);

Combines two images and produces a single image that is the composite of a left and right image of a stereo pair. Special red-green stereo glasses are required to view this effect.

void strip();

Strips an image of all profiles and comments.

void syncProfiles();

synchronizes image properties with the image profiles. Currently we only support updating the EXIF resolution and orientation.

void swirl(double degrees);

Swirls the pixels about the center of the image, where degrees indicates the sweep of the arc through which each pixel is moved. You get a more dramatic effect as the degrees move from 1 to 360.

void threshold(Quantum value);

Changes the value of individual pixels based on the intensity of each pixel compared to threshold. The result is a high-contrast, two color image.

See Also:
dmagick.Image.bilevel.

void thumbnail(Geometry size);

changes the size of an image to the given dimensions and removes any associated profiles. The goal is to produce small low cost thumbnail images suited for display on the Web.

void[] toBlob(string magick = null, size_t depth = 0);

Creates a Binary Large OBject, a direct-to-memory version of the image.

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.

Parameters:

string magick specifies the image format to write.
size_t depth specifies the image depth.

void transparent(Color color, Quantum opacity = TransparentOpacity, bool invert = false);

Changes the opacity value of all the pixels that match color to the value specified by opacity. By default the pixel must match exactly, but you can specify a tolerance level by setting the fuzz attribute on the image.

Parameters:

target The target color.
Quantum opacity The desired opacity.
bool invert If true, all pixels outside the range are set to opacity.

void transparentChroma(Color low, Color high, Quantum opacity = TransparentOpacity, bool invert = false);

Changes the opacity value associated with any pixel between low and high to the value defined by opacity.

As there is one fuzz value for the all the channels, the transparent method is not suitable for the operations like chroma, where the tolerance for similarity of two color components (RGB) can be different, Thus we define this method take two target pixels (one low and one high) and all the pixels of an image which are lying between these two pixels are made transparent.

Parameters:

Color low The low end of the pixel range.
Color high The high end of the pixel range.
Quantum opacity The desired opacity.
bool invert If true, all pixels outside the range are set to opacity.

void transpose();

Creates a horizontal mirror image by reflecting the pixels around the central y-axis while rotating them by 90 degrees.

void transverse();

Creates a vertical mirror image by reflecting the pixels around the central x-axis while rotating them by 270 degrees

void trim();

Removes the edges that are exactly the same color as the corner pixels. Use the fuzz property to make trim remove edges that are nearly the same color as the corner pixels.

Image uniqueColors();

Constructs a new image with one pixel for each unique color in the image. The new image has 1 row. The row has 1 column for each unique pixel in the image.

void unsharpMask(double radius = 0, double sigma = 1, double amount = 1, double threshold = 0.05, ChannelType channel = (ChannelType).DefaultChannels);

Sharpens an image. We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and unsharpMask selects a suitable radius for you.

Parameters:

double radius The radius of the Gaussian operator.
double sigma The standard deviation of the Gaussian operator.
double amount The percentage of the blurred image to be added to the receiver, specified as a fraction between 0 and 1.0. A good starting value is 1.0
double threshold The threshold needed to apply the amount, specified as a fraction between 0 and 1.0.
ChannelType channel The channels to sharpen.

dmagick.ImageView.ImageView view(Geometry area = (Geometry).init);

Get a view into the image. The ImageView can be used to modify individual pixels of the image.

Parameters:

Geometry area The area accessible through the view.

void vignette(ssize_t xOffset, ssize_t yOffset, double radius = 0, double sigma = 10);

Gradually shades the edges of the image by transforming the pixels into the background color.

Larger values of sigma increase the blurring at the expense of increased execution time. In general, radius should be larger than sigma, although if radius is 0 then ImageMagick will choose a suitable value. Sigma must be non-zero. Choose a very small value for sigma to produce a "hard" edge.  

Parameters:

ssize_t xOffset Influences the amount of background color in the horizontal dimension.
ssize_t yOffset Influences the amount of background color in the vertical dimension.
double radius The radius of the pixel neighborhood.
double sigma The standard deviation of the Gaussian, in pixels.

void wave(double amplitude = 25, double wavelength = 150);

Creates a "ripple" effect in the image by shifting the pixels vertically along a sine wave whose amplitude and wavelength is specified by the given parameters.Creates a "ripple" effect in the image by shifting the pixels vertically along a sine wave whose amplitude and wavelength is specified by the given parameters.

void whiteThreshold(Quantum threshold, ChannelType channel = (ChannelType).DefaultChannels);
void whiteThreshold(Quantum red, Quantum green, Quantum blue, Quantum opacity = 0, ChannelType channel = (ChannelType).DefaultChannels);

Forces all pixels above the threshold into white while leaving all pixels below the threshold unchanged.

Parameters:

Quantum threshold The threshold value for red green and blue.
ChannelType channel One or more channels to adjust.

void write(string filename);

Writes the image to the specified file. ImageMagick determines image format from the prefix or extension.

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.

void alpha(AlphaChannelType type);
const bool alpha();

Set a flag to indicate whether or not to use alpha channel data.

void animationDelay(Duration delay);
const Duration animationDelay();

Number time which must expire before displaying the next image in an animated sequence.

void animationIterations(size_t iterations);
const size_t animationIterations();

Number of iterations to loop an animation.

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

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

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

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

const Geometry boundingBox();

Return smallest bounding box enclosing non-border pixels. The current fuzz value is used when discriminating between pixels.

static void cacheThreshold(size_t threshold);

Pixel cache threshold in megabytes. 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

const bool changed();

returns true if any pixel in the image has been altered since it was first constituted.

void channelDepth(ChannelType channel, size_t depth);
const size_t channelDepth(ChannelType channel);

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.

void chromaticity(ChromaticityInfo chroma);
const ChromaticityInfo chromaticity();

The red, green, blue, and white-point chromaticity values.

void classType(ClassType type);
const ClassType classType();

The image's storage class. If DirectClass then the pixels contain valid RGB or CMYK colors. If PseudoClass then the image has a colormap referenced by the pixel's index member.

void clipMask(const(Image) image);
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.

auto colormap();

Access the image color map. Only ClassType.PsseudoClass images have a colormap.

 Color color = image.colormap[2];
 image.colormap()[2] = color;
To asign the complete colormap at once:
 Color[] colors = new Colors[255];
 image.colormap() = colors;
 //Or
 image.colormap.size = 255;
 foreach(i, color; colors)
     image.colormap()[i] = color;

BUGS:
because of dmd bug 2152 the parentheses are needed when assigning;

void colormapSize(size_t size);
const size_t colormapSize();

The number of colors in the colormap. Only meaningful for PseudoClass images.

Setting the colormap size may extend or truncate the colormap. The maximum number of supported entries is specified by the MaxColormapSize constant, 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.

void colorspace(ColorspaceType type);
const ColorspaceType colorspace();

The colorspace used to represent the image pixel colors. Image pixels are always stored as RGB(A) except for the case of CMY(K).

const size_t columns();

The width of the image in pixels.

void compose(CompositeOperator op);
const CompositeOperator compose();

Composition operator to be used when composition is implicitly used (such as for image flattening).

void compression(CompressionType type);
const CompressionType compression();

The image compression type. The default is the compression type of the specified image file.

void density(Geometry value);
const Geometry density();

The vertical and horizontal resolution in pixels of the image. This option specifies an image density when decoding a Postscript or Portable Document page.

The default is "72x72".

void depth(size_t value);
const 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.

const string directory();

Tile names from within an image montage. Only valid after calling montage or reading a MIFF file which contains a directory.

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

Specify (or obtain) endian option for formats which support it.

void exifProfile(void[] blob);
const void[] exifProfile();

The EXIF profile.

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

The image filename.

const MagickSizeType fileSize();

The image filesize in bytes.

void filter(FilterTypes type);
const FilterTypes filter();

Filter to use when resizing image. The reduction filter employed has a significant 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.

const string format();

The image encoding format. For example, "GIF" or "PNG".

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.

const double gamma();

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.

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

Preferred size of the image when encoding.

void gifDisposeMethod(DisposeType type);
const DisposeType gifDisposeMethod();

GIF disposal method. This attribute is used to control how successive images are rendered (how the preceding image is disposed of) when creating a GIF animation.

bool gray();

Returns true if all the pixels in the image have the same red, green, and blue intensities.

const ulong[Color] histogram();

Computes the number of times each unique color appears in the image. You may want to quantize the image before using this property.

Returns:
A associative array. Each key reprecents a color in the Image. The value is the number of times the color apears in the image.

void iccColorProfile(void[] blob);
const void[] iccColorProfile();

ICC color profile.

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 iptcProfile(void[] blob);
const void[] iptcProfile();

The International Press Telecommunications Council profile.

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".

const double meanErrorPerPixel();

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.

void modulusDepth(size_t depth);
const size_t modulusDepth();

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.

void monitor(bool delegate(string methodName, long offset, ulong extent) progressMonitor);
bool delegate(string, long, ulong) monitor();

Establish a progress monitor. Most Image and ImageList methods will periodically call the monitor with arguments indicating the progress of the method.

The delegate receves the folowing parameters:

string methodNameThe name of the monitored method.
long offset A number between 0 and extent that identifies how much of the operation has been completed (or, in some cases, remains to be completed).
ulong extent The number of quanta needed to complete the operation.

const Geometry montageGeometry();

Tile size and offset within an image montage. Only valid for images produced by montage.

const double normalizedMaxError();

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.

const double normalizedMeanError();

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.

void opDispatch(string property)(string value);

Sets the value of the image property. An image may have any number of properties. ImageMagick predefines some properties, including attribute, label, caption, comment, signature, and in some cases EXIF.

auto opDispatch(string property)();

Returns the value of the image property.

void orientation(OrientationType orientation);
const OrientationType orientation();

Image orientation. Supported by some file formats such as DPX and TIFF. Useful for turning the right way up.

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

When compositing, this attribute describes the position of this image with respect to the underlying image.

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).

void pixelInterpolationMethod(InterpolatePixelMethod method);
const InterpolatePixelMethod pixelInterpolationMethod();

The pixel color interpolation method. Some methods (such as wave, swirl, implode, and composite) use the pixel color interpolation method to determine how to blend adjacent pixels.

void profile(string name, void[] blob);
const void[] profile(string name);

Get/set/remove a named profile. Valid names include "*", "8BIM", "ICM", "IPTC", or a user/format-defined profile name.

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

JPEG/MIFF/PNG compression level (default 75).

void renderingIntent(RenderingIntent intent);
const RenderingIntent renderingIntent();

The type of rendering intent.

See Also:
http://www.cambridgeincolour.com/tutorials/color-space-conversion.htm

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

Units of image resolution

void scene(size_t value);
const size_t scene();

The scene number assigned to the image the last time the image was written to a multi-image image file.

const size_t rows();

The height of the image in pixels.

const Geometry size();

Width and height of a image.

const size_t totalColors();

Number of colors in the image.

void type(ImageType imageType);
const ImageType type();

Image type.

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

Specify how "virtual pixels" behave. Virtual pixels are pixels that are outside the boundaries of the image. Methods such as blurImage, sharpen, and wave use virtual pixels.

const double xResolution();

Horizontal resolution of the image.

const double yResolution();

Vertical resolution of the image.