Encapsulation of the ImageMagick Image object.
We use MagickImage here so as not to be confused
with java.awt.Image.
addNoiseImage
public MagickImage addNoiseImage(int noiseType)
throws MagickException Adds random noise to the image.
noiseType - The type of noise: Uniform, Gaussian, Multiplicative,
Impulse, Laplacian, or Poisson.
- An image with additional noise.
allocateImage
public void allocateImage(ImageInfo imageInfo)
Allocate a blank image object.
imageInfo - specifies the parameters for the blank image
annotateImage
public void annotateImage(DrawInfo info)
averageImages
public MagickImage averageImages()
throws MagickException The Average() method takes a set of images and
averages them together. Each image in the set must
have the same width and height.
- an image with the pixel component of each image averaged.
blobToImage
public void blobToImage(ImageInfo imageInfo,
byte[] blob)
throws MagickException Takes from memory an image in a known format and read it into
itself.
imageInfo - a ImageInfo instanceblob - memory containing an image in a known format
blurImage
public MagickImage blurImage(double raduis,
double sigma)
throws MagickException 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. Use a radius of 0
and BlurImage() selects a suitable radius for you.
raduis - The radius of the gaussian, in pixels, not counting
the center pixelsigma - The standard deviation of the gaussian, in pixels
borderImage
public MagickImage borderImage(Rectangle borderInfo)
throws MagickException Surrounds the image with a border of the color defined by
the border color member of the image structure. The width
and height of the border are defined by the corresponding
members of the Rectangle.
borderInfo - the rectangle for which border is drawn
- an Image with a border around it
breakFrames
public MagickImage[] breakFrames()
throws MagickException Destructively create array of image frames. Contains this image
as the first object and frames in sequence.
charcoalImage
public MagickImage charcoalImage(double raduis,
double sigma)
throws MagickException Creates a new image that is a copy of an existing one with the
edges highlighted, producing a 'charcoal-drawing' effect.
raduis - The radius of the pixel neighborhood.sigma - The standard deviation of the gaussian, in pixels
chopImage
public MagickImage chopImage(Rectangle chopInfo)
throws MagickException Creates a new image that is a subregion of the original.
chopInfo - the rectange to chop the image
cloneImage
public MagickImage cloneImage(int columns,
int rows,
boolean clonePixels)
throws MagickException Returns a copy of all fields of the input image.
The the pixel memory is allocated but the pixel data is copy
is optional.
colorFloodfillImage
public boolean colorFloodfillImage(DrawInfo drawInfo,
PixelPacket target,
int x,
int y,
int method)
throws MagickException Changes the color value of any pixel that matches target
and is an immediate neighbor. If the method FillToBorderMethod
is specified, the color value is changed for any neighbor pixel
that does not match the bordercolor member of image.
By default target must match a particular pixel color exactly.
However, in many cases two colors may differ by a small amount.
The fuzz member 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.
drawInfo - The draw infotarget - The RGB value of the target colourx - the starting x location of the operationy - the starting y location of the operationmethod - either FloodfillMethod or FilltoBorderMethod
- true or false depending on success or failure respectively
colorizeImage
public MagickImage colorizeImage(String opacity,
PixelPacket target)
throws MagickException Colourises the image with a pen colour.
opacity - string percentage value for opacitytarget - a colour value
compositeImage
public boolean compositeImage(int compOp,
MagickImage compImage,
int xOff,
int yOff)
throws MagickException Composite the image supplied onto itself at the specified offsets.
constituteImage
public void constituteImage(int width,
int height,
String map,
byte[] pixels)
throws MagickException Create a new image of 8-bit component of the specified dimensions.
width - the width of the new imageheight - the height of the new imagemap - the components of a pixelpixels - the raw image in an array of pixels
constituteImage
public void constituteImage(int width,
int height,
String map,
float[] pixels)
throws MagickException Create a new image of float component of the specified dimensions.
width - the width of the new imageheight - the height of the new imagemap - the components of a pixelpixels - the raw image in an array of pixels
constituteImage
public void constituteImage(int width,
int height,
String map,
int[] pixels)
throws MagickException Create a new image of 32-bit component of the specified dimensions.
width - the width of the new imageheight - the height of the new imagemap - the components of a pixelpixels - the raw image in an array of pixels
contrastImage
public boolean contrastImage(boolean sharpen)
throws MagickException Enhances the intensity differences between the lighter and
darker elements of the image.
- a boolean value to indicate success
convolveImage
public MagickImage convolveImage(int order,
double[] kernel)
throws MagickException Applies a general image convolution kernel to an image returns
the results. ConvolveImage allocates the memory necessary for
the new Image structure and returns a pointer to the new image.
order - The number of columns and rows in the filter kernel.kernel - An array of double representing the convolution kernel
cropImage
public MagickImage cropImage(Rectangle chopInfo)
throws MagickException Creates a new image that is a subregion of the original.
- a subimage of the original
cycleColormapImage
public void cycleColormapImage(int amount)
throws MagickException Cycles the image colormap by a specified amount.
despeckleImage
public MagickImage despeckleImage()
throws MagickException Creates a new image that is a copy of an existing one with the
speckle noise minified. It uses the eight hull algorithm described
in Applied Optics, Vol. 24, No. 10, 15 May 1985, ``Geometric filter
for Speckle Reduction'', by Thomas R Crimmins. Each pixel in the
image is replaced by one of its eight of its surrounding pixels
using a polarity and negative hull function.
destroyImages
public void destroyImages()
Called by finalize to deallocate the image handle.
dispatchImage
public boolean dispatchImage(int x,
int y,
int width,
int height,
String map,
byte[] pixels)
throws MagickException Get the pixels as 8-bit components from the image.
x - x coordinate of the origin of the subimagey - y coordinate of the origin of the subimagewidth - width of the subimageheight - height of the subimagemap - component order of the pixelspixels - pixels of the subimage
- a boolean value indicating success
dispatchImage
public boolean dispatchImage(int x,
int y,
int width,
int height,
String map,
float[] pixels)
throws MagickException Get the pixels as float components from the image.
x - x coordinate of the origin of the subimagey - y coordinate of the origin of the subimagewidth - width of the subimageheight - height of the subimagemap - component order of the pixelspixels - pixels of the subimage
- a boolean value indicating success
dispatchImage
public boolean dispatchImage(int x,
int y,
int width,
int height,
String map,
int[] pixels)
throws MagickException Get the pixels as 32-bit components from the image.
x - x coordinate of the origin of the subimagey - y coordinate of the origin of the subimagewidth - width of the subimageheight - height of the subimagemap - component order of the pixelspixels - pixels of the subimage
- a boolean value indicating success
drawImage
public boolean drawImage(DrawInfo aInfo)
throws MagickException Draws a primitive (line, rectangle, ellipse) on the image.
- a boolean value to indicate success
edgeImage
public MagickImage edgeImage(double raduis)
throws MagickException Finds edges in an image. Radius defines the radius of the convolution
filter. Use a radius of 0 and Edge() selects a suitable radius for you.
raduis - The radius of the pixel neighborhood.
- A new image with the edges hilighted.
embossImage
public MagickImage embossImage(double raduis,
double sigma)
throws MagickException Returns a grayscale image with a three-dimensional effect.
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 Emboss() selects
a suitable radius for you.
raduis - The radius of the pixel neighborhood.sigma - The standard deviation of the Gaussian, in pixels
enhanceImage
public MagickImage enhanceImage()
throws MagickException Applies a digital filter that improves the quality of a noisy image.
equalizeImage
public boolean equalizeImage()
throws MagickException Performs histogram equalization.
- a boolean value to indicate success
finalize
protected void finalize()
This method will clean up the handle.
flipImage
public MagickImage flipImage()
throws MagickException Creates a new image that reflects each scanline
in the vertical direction.
- a new image that has been flipped
flopImage
public MagickImage flopImage()
throws MagickException Creates a new image that reflects each scanline in the
horizontal direction
- a new image that has been flopped
gammaImage
public boolean gammaImage(String gamma)
throws MagickException Converts the reference image to gamma corrected colors.
- a boolean value to indicate success
gaussianBlurImage
public MagickImage gaussianBlurImage(double raduis,
double sigma)
throws MagickException Blurs the image using a gaussian operator. The effectiveness of the
operator - and the amount of blurring - is controlled by selecting
a 'radius' and a 'sigma'. The radius sets the circle around each
pixel of the 'neighborhood' used for calculating an average pixel
color. Sigma determines how much the calculated average affects the
pixel.
raduis - The radius of the Gaussian, in pixels, not counting
the center pixelsigma - The standard deviation of the Gaussian, in pixels.
getBackgroundColor
public PixelPacket getBackgroundColor()
throws MagickException Get the current background colour.
- the current background colour
getBorderColor
public PixelPacket getBorderColor()
throws MagickException Get the current border colour used by method borderImage.
- the current border colour
getColorProfile
public ProfileInfo getColorProfile()
throws MagickException Obtain the color profile from the image.
- the color profile of the image
getColormap
public PixelPacket getColormap(int index)
throws MagickException Get the colour specified by the index.
index - the index for which to return a colour
getColors
public int getColors()
throws MagickException The number of colors in the colourmap.
- the current number of colors in the image
getColorspace
public int getColorspace()
throws MagickException Get the colorspace of the image.
- the colorspace as defined in ColorspaceType
getCompression
public int getCompression()
throws MagickException Get the CompressionType of the image.
- the compression as defined in CompressionType
getDelay
public int getDelay()
throws MagickException Get the 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.
getDepth
public int getDepth()
throws MagickException Return the depth of the image.
getDispose
public int getDispose()
throws MagickException Get the 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.
- the current disposal method for GIF animation
getFileName
public String getFileName()
throws MagickException Return the image file name of the image.
- the file name of the image
getGenericProfile
public ProfileInfo getGenericProfile(int i)
throws MagickException Return the generic profile specified by the index.
- a generic ProfileInfo if found, null otheriwse.
getGenericProfileCount
public int getGenericProfileCount()
throws MagickException Return the number of generic profiles.
- number of generic profiles
getImageAttribute
public String getImageAttribute(String key)
throws MagickException Searches the list of image attributes and returns
the value of the attribute if it exists otherwise null.
key - the key of the attribute
- the value of the attribute if exists, otherwise, null.
getImageType
public int getImageType()
throws MagickException Get the image type from the MagickImage
getIptcProfile
public ProfileInfo getIptcProfile()
throws MagickException Obtain the IPTC profile from the image.
- the IPTC profile of the image
getIterations
public int getIterations()
throws MagickException Get the number of iterations to loop an animation (e.g. Netscape
loop extension) for.
- the current number of iterations
getMagick
public String getMagick()
throws MagickException Return the image format (i.e., Gif, Jpeg,...)
- the string representing the image format
getNumberColors
public int getNumberColors()
throws MagickException Return the number of unique colors in an image.
- the number of unique colors
getOnePixel
public PixelPacket getOnePixel(int x,
int y)
throws MagickException Get the colour at the specified row and column
x - the x position of the pixel to fetchy - the y position of the pixel to fetch
getQuality
public int getQuality()
throws MagickException- the quality the image was saved
getStorageClass
public int getStorageClass()
throws MagickException Return the storage class of the image.
- the store class as defined in ClassType
getTotalColors
public int getTotalColors()
throws MagickException Get the The number of colors in the image after QuantizeImage(),
or QuantizeImages().
- the current number of colors in the image
getUnits
public int getUnits()
throws MagickException Get the units attribute of the image.
- A integer representing the resolution type as defined
in ResolutionType
getXResolution
public double getXResolution()
throws MagickException Get the x_resolution attribute in the image.
getYResolution
public double getYResolution()
throws MagickException Get the y_resolution attribute in the image.
hasFrames
public boolean hasFrames()
throws MagickException Check if the image has multiple frames.
- true if the image has multiple frames, false, otherwise.
imageToBlob
public byte[] imageToBlob(ImageInfo imageInfo)
Returns an array that contents the image format.
imageInfo - the magick member of this object determines
output format
- a byte array containing the image in the specified format
implodeImage
public MagickImage implodeImage(double amount)
throws MagickException Implodes the image's pixels about the center.
amount - Amount of implosion if positive, explosion if negative.
isAnimatedImage
public boolean isAnimatedImage()
throws MagickException Returns True if the Gif image is Animated otherwise False is returned.
- a boolean value representing the animated status of the image
isGrayImage
public boolean isGrayImage()
throws MagickException Returns True if the image is grayscale otherwise False is returned.
- a boolean value to indicate success
isMonochromeImage
public boolean isMonochromeImage()
throws MagickException Returns True if the image is monochrome otherwise False is returned.
- a boolean value to indicate success
levelImage
public boolean levelImage(String levels)
throws MagickException Adjusts the levels of an image given these points: black,
mid, and white.
- true if successful, false otherwise.
magnifyImage
public MagickImage magnifyImage()
throws MagickException Creates a new image that is a integral size greater
than an existing one.
matteFloodfillImage
public boolean matteFloodfillImage(PixelPacket target,
int matte,
int x,
int y,
int method)
throws MagickException Floodfills the designated area with a matte value.
- a boolean value to indicate success
medianFilterImage
public MagickImage medianFilterImage(double radius)
throws MagickException 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.
radius - The radius of the pixel neighborhood.
minifyImage
public MagickImage minifyImage()
throws MagickException Creates a new image that is a integral size less than an existing one.
modulateImage
public boolean modulateImage(String modulate)
throws MagickException Modulates the hue, saturation, and brightness of an image.
- a boolean value to indicate success
montageImages
public MagickImage montageImages(MontageInfo montageInfo)
throws MagickException Create a montage of all the images in the list.
montageInfo - parameter used in the creation of the montage
- a montage of all images in the list
negateImage
public boolean negateImage(int grayscale)
throws MagickException Negates the colors in the reference image. The Grayscale
option means that only grayscale values within the image are negated.
- a boolean value to indicate success
nextImage
protected MagickImage nextImage()
throws MagickException Return image object for next image in sequence of frames.
Also sets the next image pointer to NULL.
- next image or null if end of list.
normalizeImage
public boolean normalizeImage()
throws MagickException Normalizes the pixel values to span the full range of color values.
This is a contrast enhancement technique.
- a boolean value to indicate success
oilPaintImage
public MagickImage oilPaintImage(double radius)
throws MagickException 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.
radius - The radius of the pixel neighborhood.
- A new, simulated oil-painting, image.
opaqueImage
public boolean opaqueImage(PixelPacket target,
PixelPacket penColor)
throws MagickException Changes the color of an opaque pixel to the pen color.
target - the color to search for in the imagepenColor - the color to replace it with
- a boolean value to indicate success
pingImage
public void pingImage(ImageInfo imageInfo)
throws MagickException Pings the image.
imageInfo - the ImageInfo for an image file to read
profileImage
public boolean profileImage(String profileName,
byte[] profileData)
throws MagickException ProfileImage adds or removes a ICM, IPTC, or generic profile
from an image. If the profile name is defined it is deleted
from the image. If a filename is given, one or more profiles
are read and added to the image.
profileName - name of profile to add or remove
- Returns a true if the profile is successfully added or removed
quantizeImage
public boolean quantizeImage(QuantizeInfo quantizeInfo)
throws MagickException 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.
quantizeInfo - contains parameters for quantization
- a boolean value indicating success of the process
raiseImage
public boolean raiseImage(Rectangle raiseInfo,
boolean raise)
throws MagickException Creates a simulated three-dimensional button-like effect by
lightening and darkening the edges of the image. Members width
and height of raiseInfo define the width of the vertical and
horizontal edge of the effect.
raiseInfo - the rectangle for which border is drawnraise - true to create raise effect, false to lower
- true if successful, false otherwise
readImage
public void readImage(ImageInfo imageInfo)
throws MagickException Read the image specified in the ImageInfo object.
imageInfo - specifies the file to read from
reduceNoiseImage
public MagickImage reduceNoiseImage(double radius)
throws MagickException This operation attempts to reduce the 'noise' in the image. This
can be used to eliminate minor dust and scratches from scanned
images.
The principal function of the noise peak elimination filter is to
smooth the objects within an image without losing edge information
and without creating undesired structures. The central idea of the
algorithm is to replace a pixel with its next neighbor in value in
a circular neighborhood if this pixel has been found to be noise. A
pixel is defined as noise if the pixel is a minimum or maximum
within the neighborhood.
radius - The radius of the pixel neighborhood.
rgbTransformImage
public boolean rgbTransformImage(int colorspace)
throws MagickException Converts the reference image from RGB to an alternate colorspace.
The transformation matrices are not the standard ones: the weights
are rescaled to normalized the range of the transformed values to
be [0..MaxRGB].
colorspace - the target colorspace to transform to
- a boolean value to indicate success
rollImage
public MagickImage rollImage(int xOffset,
int yOffset)
throws MagickException Rolls an image vertically and horizontally.
xOffset - An integer that specifies the number of columns \
to roll in the horizontal directionyOffset - An integer that specifies the number of rows to \
roll in the vertical direction
rotateImage
public MagickImage rotateImage(double degrees)
throws MagickException Creates a new image that is a rotated copy of an existing one.
Positive angles rotate counter-clockwise (right-hand rule), while
negative angles rotate clockwise. Rotated images are usually larger
than the originals and have 'empty' triangular corners. X axis.
Empty triangles left over from shearing the image are filled with
the color defined by the pixel at location (0,0).
- A image that is a rotation of self
sampleImage
public MagickImage sampleImage(int cols,
int rows)
throws MagickException Creates a new image that is a scaled size of an existing one
using pixel sampling.
cols - An integer that specifies the number of columns in \
the sampled imagerows - An integer that specifies the number of rows in the \
sampled image
scaleImage
public MagickImage scaleImage(int cols,
int rows)
throws MagickException Return a new image that is a scaled version of the
original. To scale a scanline from x pixels to y pixels, each new
pixel represents x/y old pixels. To read x/y pixels, read
(x/y rounded up) pixels but only count the required fraction of
the last old pixel read in your new pixel. The remainder of the
old pixel will be counted in the next new pixel.
cols - An integer that specifies the number of columns in \
the scaled imagerows - An integer that specifies the number of rows in the \
scaled image
segmentImage
public int segmentImage(int colorspace,
double cluster_threshold,
double smoothing_threshold)
throws MagickException Segment an image by analyzing the histograms of the color components
and identifying units that are homogeneous using the fuzzy c-means
technique.
colorspace - A ColorspaceType value that indicates the
colorspace. Empirical evidence suggests that
distances in YUV or YIQ correspond to perceptual
color differences more closely than do distances
in RGB space. The image is then returned to RGB
colorspace after color reduction.cluster_threshold - Specify cluster threshold as the number of
pixels in each cluster must exceed the the
cluster threshold to be considered valid.smoothing_threshold - Smoothing threshold 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.
- The actual number of colors allocated in the colormap.
setBackgroundColor
public void setBackgroundColor(PixelPacket color)
throws MagickException Set the background colour.
color - the background colour
setBorderColor
public void setBorderColor(PixelPacket color)
throws MagickException Set the border colour for the method borderImage.
color - the border colour
setColorProfile
public void setColorProfile(ProfileInfo profile)
throws MagickException Set a new color profile for the image.
profile - a new color profile. This parameter cannot be null.
setCompression
public void setCompression(int value)
throws MagickException Set the compression attribute.
value - a value from CompressionType
setDelay
public void setDelay(int delay)
throws MagickException Set the 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.
delay - the time delay in 1/100th of a second
setDispose
public void setDispose(int dispose)
throws MagickException Set the 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.
dispose - the disposal method for GIF animation
setGrayscale
public void setGrayscale()
throws MagickExceptionUse QuantizeInfo with MagickImage.quantizeImage
to acheive the same effect.
Convert any colored image to grayscale.
setImageAttribute
public boolean setImageAttribute(String key,
String value)
throws MagickException Searches the list of image attributes and replaces the
attribute value. If it is not found in the list, the attribute name
and value is added to the list. SetImageAttribute returns True if the
attribute is successfully replaced or added to the list, otherwise
False. If the value is null, the matching key is deleted from the list.
key - the key of the attributevalue - the value of the attribute
- true if the attribute is replace or false if added
setImageFormat
public void setImageFormat(String imageFormat)
throws MagickException
setIptcProfile
public void setIptcProfile(ProfileInfo profile)
throws MagickException Set a new IPTC profile for the image.
profile - a new IPTC profile. This parameter cannot be null.
setIterations
public void setIterations(int iterations)
throws MagickException Set the number of iterations to loop an animation (e.g. Netscape
loop extension) for.
iterations - the number of iterations
setNumberColors
public void setNumberColors(int numberColors)
throws MagickException
setUnits
public void setUnits(int resolutionType)
throws MagickException Set the units attribute of the image.
setXResolution
public void setXResolution(double xRes)
throws MagickException Set the x_resolution attribute in the image.
xRes - x_resolution value
setYResolution
public void setYResolution(double yRes)
throws MagickException Get the y_resolution attribute in the image.
yRes - y_resolution value
sharpenImage
public MagickImage sharpenImage(double raduis,
double sigma)
throws MagickException Creates a new image that is a copy of an existing one with the
pixels sharpened.
raduis - The radius of the gaussian, in pixels, not counting \
the center pixelsigma - The standard deviation of the gaussian, in pixels
shearImage
public MagickImage shearImage(double x_shear,
double y_shear)
throws MagickException Creates a new image that is a shear_image copy of an existing one.
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_shear is measured relative to the Y axis, and similarly, for Y
direction shears y_shear is measured relative to the X axis. Empty
triangles left over from shearing the image are filled with the color
defined by the pixel at location (0,0).
x_shear - x direction shear amounty_shear - y direction shear amount
- a sheared image constructor from self.
signatureImage
public boolean signatureImage()
throws MagickException Determine signature of image and place signature
in the image's attributes.
- true if successful, false, otherwise
- Elizabeth Barham <soggytrousers@yahoo.com>
sizeBlob
public int sizeBlob()
throws MagickException Returns the current length of the image file or blob.
- current length of the image file or blob
solarizeImage
public void solarizeImage(double threshold)
throws MagickException 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.
threshold - Ranges from 0 to MaxRGB and is a measure of the
extent of the solarization.
sortColormapByIntensity
public boolean sortColormapByIntensity()
throws MagickException Sorts the colormap of a PseudoClass image by decreasing
color intensity.
- a boolean value indicating success
spreadImage
public MagickImage spreadImage(int radius)
throws MagickException A special effects method that randomly displaces each pixel in a
block defined by the radius parameter.
radius - Choose a random pixel in a neighborhood of this extent.
swirlImage
public MagickImage swirlImage(double degress)
throws MagickException 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.
syncImage
public void syncImage()
throws MagickException Initializes the red, green, and blue intensities of each
pixel as defined by the colormap index.
textureImage
public void textureImage(MagickImage image)
throws MagickException Layers a texture onto the background of an image.
image - the image to use for texture
thresholdImage
public boolean thresholdImage(double threshold)
throws MagickException Thresholds the reference image.
threshold - the threshold value
- a boolean value indicating success
transformImage
public void transformImage(String cropGeometry,
String imageGeometry)
throws MagickException Creates a new image that is a transformed size of of
existing one as specified by the crop and image geometries.
If a crop geometry is specified a subregion of the image is
obtained. If the specified image size, as defined by the image
and scale geometries, is smaller than the actual image size, the
image is first minified to an integral of the specified image
size with an antialias digital filter. The image is then scaled to
the exact specified image size with pixel replication. If the
specified image size is greater than the actual image size, the
image is first enlarged to an integral of the specified image size
with bilinear interpolation. The image is then scaled to the exact
specified image size with pixel replication.
cropGeometry - a crop geometry string. This geometry \
defines a subregion of the image.imageGeometry - a image geometry string. The specified \
width and height of this geometry string
are absolute.
transformRgbImage
public boolean transformRgbImage(int colorspace)
throws MagickException Converts the reference image from an alternate colorspace.
The transformation matrices are not the standard ones:
the weights are rescaled to normalized the range of the
transformed values to be [0..MaxRGB].
colorspace - An unsigned integer value defines which \
colorspace to transform the image to
- a boolean value indicating success
transparentImage
public boolean transparentImage(PixelPacket color,
int opacity)
throws MagickException Creates a matte image associated with the image.
color - The color to search for in the imageopacity - The opacity of the transparent image
- a boolean value indicating success
unsharpMaskImage
public MagickImage unsharpMaskImage(double raduis,
double sigma,
double amount,
double threshold)
throws MagickException Creates a new image that is a copy of an existing one with
the pixels sharpened using an "unsharp" masking technique.
This process starts by building a temporary,
blurred, copy of the image. Then each
pixel in this "unsharp" image is compared
against its corresponding pixel in the original image. If
their difference is above a threshold, a percentage of the
difference is added back into the original pixel.
The first two arguments,
radius and
sigma,
specify the blurring used to create the "unsharp" image. See
gaussianBlurImage(double,double) for a detail explanation. It will
suffice to say that the larger the radius and sigma the more
this blurred image will diverge from the original.
The last two arguments,
threshold and
amount,
specify the difference threshold required to apply an adjustment
to each pixel and, once the threshold is reached, the amount of
the difference to be added back into the original pixels. A high
threshold will cause the algorithm to only adjust edge pixels.
Specifying a threshold will adjust every pixel.
raduis - The radius of the gaussian, in pixels, not counting
the center pixelsigma - The standard deviation of the gaussian, in pixelsamount - The percentage of the difference between the original
and the blur image that is added back into the original.threshold - The threshold in pixels needed to apply the diffence
amount.
waveImage
public MagickImage waveImage(double amplitude,
double wavelength)
throws MagickException 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.
amplitude - Define the amplitude of the sine wave.wavelength - Define the wave-length of the sine wave.
writeImage
public boolean writeImage(ImageInfo imageInfo)
throws MagickException Write the image specified in the ImageInfo object.
imageInfo - specifies the writing parameters
zoomImage
public MagickImage zoomImage(int cols,
int rows)
throws MagickException Creates a new image that is a scaled size of an existing one.