Class MagickImage
- java.lang.Object
-
- magick.Magick
-
- magick.MagickImage
-
public class MagickImage extends Magick
Encapsulation of the ImageMagick Image object. We use MagickImage here so as not to be confused with java.awt.Image.- Author:
- Eric Yeo
-
-
Constructor Summary
Constructors Constructor Description MagickImage()Constructor.MagickImage(ImageInfo imageInfo)Constructor that also reads an image file specified in the parameter.MagickImage(ImageInfo imageInfo, boolean ping)Constructor that also reads an image file specified in the parameter.MagickImage(ImageInfo imageInfo, byte[] blob)Constructor that takes the image to be read from memory.MagickImage(MagickImage[] images)Construct a MagickImage that is made up of all the images in the specified array.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MagickImageaddNoiseImage(int noiseType)Adds random noise to the image.MagickImageaddNoiseImage(int noiseType, double attenuate)Adds random noise to the image.voidallocateImage(ImageInfo imageInfo)Allocate a blank image object.voidannotateImage(DrawInfo info)Annotates an image with test.MagickImageautoOrientImage()This operator reads and resets the EXIF image profile setting 'Orientation' and then performs the appropriate 90 degree rotation on the image to orient the image, for correct viewing.MagickImageaverageImages()The Average() method takes a set of images and averages them together.voidblobToImage(ImageInfo imageInfo, byte[] blob)Takes from memory an image in a known format and read it into itself.MagickImageblurImage(double raduis, double sigma)Blurs an image.MagickImageblurImageChannel(int channel, double raduis, double sigma)Blurs an image.MagickImageborderImage(java.awt.Rectangle borderInfo)Surrounds the image with a border of the color defined by the border color member of the image structure.MagickImageborderImage(java.awt.Rectangle borderInfo, int compositeOperator)Surrounds the image with a border of the color defined by the border color member of the image structure.MagickImage[]breakFrames()Destructively create array of image frames.MagickImagecharcoalImage(double raduis, double sigma)Creates a new image that is a copy of an existing one with the edges highlighted, producing a 'charcoal-drawing' effect.MagickImagechopImage(java.awt.Rectangle chopInfo)Creates a new image that is a subregion of the original.MagickImagecloneImage(int columns, int rows, boolean clonePixels)Returns a copy of all fields of the input image.MagickImagecoalesceImages()Composites a set of images while respecting any page offsets and disposal methods.booleancolorFloodfillImage(DrawInfo drawInfo, PixelPacket target, int x, int y, int method)Changes the color value of any pixel that matches target and is an immediate neighbor.MagickImagecolorizeImage(java.lang.String opacity, PixelPacket target)Colourises the image with a pen colour.booleancompositeImage(int compOp, MagickImage compImage, boolean clipToSelf, int xOff, int yOff)Composite the image supplied onto itself at the specified offsets.booleancompositeImage(int compOp, MagickImage compImage, int xOff, int yOff)Composite the image supplied onto itself at the specified offsets.voidconstituteImage(int width, int height, java.lang.String map, byte[] pixels)Create a new image of 8-bit component of the specified dimensions.voidconstituteImage(int width, int height, java.lang.String map, float[] pixels)Create a new image of float component of the specified dimensions.voidconstituteImage(int width, int height, java.lang.String map, int[] pixels)Create a new image of 32-bit component of the specified dimensions.booleancontrastImage(boolean sharpen)Enhances the intensity differences between the lighter and darker elements of the image.MagickImageconvolveImage(int order, double[] kernel)Applies a general image convolution kernel to an image returns the results.MagickImagecropImage(java.awt.Rectangle chopInfo)Creates a new image that is a subregion of the original.voidcycleColormapImage(int amount)Cycles the image colormap by a specified amount.MagickImagedeconstructImages()MagickImagedespeckleImage()Creates a new image that is a copy of an existing one with the speckle noise minified.voiddestroyImages()Called by finalize to deallocate the image handle.booleandispatchImage(int x, int y, int width, int height, java.lang.String map, byte[] pixels)Get the pixels as 8-bit components from the image.booleandispatchImage(int x, int y, int width, int height, java.lang.String map, float[] pixels)Get the pixels as float components from the image.booleandispatchImage(int x, int y, int width, int height, java.lang.String map, int[] pixels)Get the pixels as 32-bit components from the image.MagickImagedisposeImages()Returns the coalesced frames of a GIF animation as it would appear after the GIF dispose method of that frame has been applied..booleandrawImage(DrawInfo aInfo)Draws a primitive (line, rectangle, ellipse) on the image.MagickImageedgeImage(double raduis)Finds edges in an image.MagickImageembossImage(double raduis, double sigma)Returns a grayscale image with a three-dimensional effect.MagickImageenhanceImage()Applies a digital filter that improves the quality of a noisy image.booleanequalizeImage()Performs histogram equalization.MagickImageextentImage(int cols, int rows, int gravity)Return a new image that is a extended version of the original.protected voidfinalize()This method will clean up the handle.MagickImageflipImage()Creates a new image that reflects each scanline in the vertical direction.MagickImageflopImage()Creates a new image that reflects each scanline in the horizontal directionTypeMetricformatMagickCaption(int maxWidth, int indent2ndLine, boolean trimLineEnds, DrawInfo draw_info, java.lang.StringBuilder caption)TypeMetricformatMagickCaption(int maxWidth, DrawInfo draw_info, java.lang.StringBuilder caption)formatMagickCaption in fact does not need an Image ObjectbooleangammaImage(java.lang.String gamma)Converts the reference image to gamma corrected colors.MagickImagegaussianBlurImage(double raduis, double sigma)Blurs the image using a gaussian operator.PixelPacketgetBackgroundColor()Get the current background colour.PixelPacketgetBorderColor()Get the current border colour used by method borderImage.java.awt.RectanglegetBoundingBox()Get bounding boxPixelPacket[]getColormap()Get the entire colour map.PixelPacketgetColormap(int index)Get the colour specified by the index.ProfileInfogetColorProfile()Obtain the color profile from the image.intgetColors()The number of colors in the colourmap.intgetColorspace()Get the colorspace of the image.intgetCompression()Get the CompressionType of the image.intgetDelay()Get the time in 1/100ths of a second (0 to 65535) which must expire before displaying the next image in an animated sequence.intgetDepth()Return the depth of the image.java.awt.DimensiongetDimension()Return the number of columns and rows of the image.intgetDispose()Get the GIF disposal method.java.lang.StringgetFileName()Return the image file name of the image.intgetFilter()Get the filter type.ProfileInfogetGenericProfile(int i)Deprecated.No longer works (after ImageMagick 5.5.7 ?)intgetGenericProfileCount()Deprecated.No longer works (after ImageMagick 5.5.7 ?)java.lang.StringgetImageAttribute(java.lang.String key)Searches the list of image attributes and returns the value of the attribute if it exists otherwise null.java.lang.StringgetImageFormat()byte[]getImageProfile(java.lang.String profileName)GetImageProfile() gets a profile associated with an image by name.intgetImageType()Get the image type from the MagickImageProfileInfogetIptcProfile()Obtain the IPTC profile from the image.intgetIterations()Get the number of iterations to loop an animation (e.g.java.lang.StringgetMagick()Return the image format (i.e., Gif, Jpeg,...)booleangetMatte()Get the matte attribute of the image.java.lang.StringgetNextImageProfile()GetNextImageProfile() gets the next profile name associated with an image.intgetNumberColors()Return the number of unique colors in an image.intgetNumberImages()Get the number of imagesintgetNumFrames()PixelPacketgetOnePixel(int x, int y)Get the colour at the specified row and columnintgetQuality()intgetRenderingIntent()Get the intent attribute of the image.intgetStorageClass()Return the storage class of the image.intgetTotalColors()Get the The number of colors in the image after QuantizeImage(), or QuantizeImages().TypeMetricgetTypeMetrics(DrawInfo info)GetTypeMetrics() returns information for the specified font and textintgetUnits()Get the units attribute of the image.doublegetXResolution()Get the x_resolution attribute in the image.doublegetYResolution()Get the y_resolution attribute in the image.booleanhasFrames()Check if the image has multiple frames.byte[]imagesToBlob(ImageInfo imageInfo)Returns the image sequence as a blob and its length.byte[]imageToBlob(ImageInfo imageInfo)Returns an array that contents the image format.MagickImageimplodeImage(double amount)Implodes the image's pixels about the center.MagickImageimplodeImage(double amount, int pixelInterpolateMethod)Implodes the image's pixels about the center.booleanisAnimatedImage()Returns True if the Gif image is Animated otherwise False is returned.booleanisGrayImage()Returns True if the image is grayscale otherwise False is returned.booleanisMonochromeImage()Returns True if the image is monochrome otherwise False is returned.booleanlevelImage(java.lang.String levels)Adjusts the levels of an image given these points: black, mid, and white.MagickImagemagnifyImage()Creates a new image that is a integral size greater than an existing one.booleanmatteFloodfillImage(PixelPacket target, int matte, int x, int y, int method)Floodfills the designated area with a matte value.MagickImagemedianFilterImage(double radius)Applies a digital filter that improves the quality of a noisy image.MagickImageminifyImage()Creates a new image that is a integral size less than an existing one.booleanmodulateImage(java.lang.String modulate)Modulates the hue, saturation, and brightness of an image.MagickImagemontageImages(MontageInfo montageInfo)Create a montage of all the images in the list.booleannegateImage(int grayscale)Negates the colors in the reference image.protected MagickImagenextImage()Return image object for next image in sequence of frames.booleannormalizeImage()Normalizes the pixel values to span the full range of color values.MagickImageoilPaintImage(double radius)Applies a special effect filter that simulates an oil painting.MagickImageoilPaintImage(double radius, double sigma)Applies a special effect filter that simulates an oil painting.booleanopaqueImage(PixelPacket target, PixelPacket penColor)Changes the color of an opaque pixel to the pen color.MagickImageoptimizeLayer(ImageInfo imageInfo)voidpingImage(ImageInfo imageInfo)Pings the image.booleanprofileImage(java.lang.String profileName, byte[] profileData)ProfileImage adds or removes a ICM, IPTC, or generic profile from an image.booleanquantizeImage(QuantizeInfo quantizeInfo)Analyzes the colors within a reference image and chooses a fixed number of colors to represent the image.booleanraiseImage(java.awt.Rectangle raiseInfo, boolean raise)Creates a simulated three-dimensional button-like effect by lightening and darkening the edges of the image.voidreadImage(ImageInfo imageInfo)Read the image specified in the ImageInfo object.MagickImagereduceNoiseImage(double radius)This operation attempts to reduce the 'noise' in the image.booleanresetImagePage(java.lang.String page)Resets the image page canvas and position.voidresetImageProfileIterator()Resets the image profile iterator.MagickImageresizeImage(int cols, int rows, double blur)Return a new image that is a resized version of the original.MagickImageresizeImage(int cols, int rows, int filter, double blur)Return a new image that is a resized version of the original, with the specified filter applied.booleanrgbTransformImage(int colorspace)Converts the reference image from RGB to an alternate colorspace.MagickImagerollImage(int xOffset, int yOffset)Rolls an image vertically and horizontally.MagickImagerotateImage(double degrees)Creates a new image that is a rotated copy of an existing one.MagickImagesampleImage(int cols, int rows)Creates a new image that is a scaled size of an existing one using pixel sampling.MagickImagescaleImage(int cols, int rows)Return a new image that is a scaled version of the original.intsegmentImage(int colorspace, double cluster_threshold, double smoothing_threshold)Segment an image by analyzing the histograms of the color components and identifying units that are homogeneous using the fuzzy c-means technique.voidsetBackgroundColor(PixelPacket color)Set the background colour.voidsetBorderColor(PixelPacket color)Set the border colour for the method borderImage.voidsetColorFuzz(double fuzz)Set color fuzzvoidsetColorProfile(ProfileInfo profile)Set a new color profile for the image.voidsetCompression(int value)Set the compression attribute.voidsetDelay(int delay)Set the time in 1/100ths of a second (0 to 65535) which must expire before displaying the next image in an animated sequence.voidsetDepth(int depth)Set the depth of the image.voidsetDispose(int dispose)Set the GIF disposal method.voidsetFileName(java.lang.String fileName)Set the image file name.voidsetFilter(int filter)Set the filter type.voidsetGrayscale()Deprecated.Use QuantizeInfo with MagickImage.quantizeImage to acheive the same effect.booleansetImageAttribute(java.lang.String key, java.lang.String value)Searches the list of image attributes and replaces the attribute value.booleansetImageColorspace(int colorspace)Sets the colorspace member of the Image structure.voidsetImageFormat(java.lang.String imageFormat)booleansetImageProfile(java.lang.String profileName, byte[] profileData)SetImageProfile() adds a named profile to the image.voidsetIptcProfile(ProfileInfo profile)Set a new IPTC profile for the image.voidsetIterations(int iterations)Set the number of iterations to loop an animation (e.g.voidsetMagick(java.lang.String imageFormat)voidsetMatte(boolean matte)Set the matte attribute of the image.voidsetNumberColors(int numberColors)voidsetQuality(int value)voidsetRenderingIntent(int renderingIntent)Set the intent attribute of the image.voidsetUnits(int resolutionType)Set the units attribute of the image.voidsetXResolution(double xRes)Set the x_resolution attribute in the image.voidsetYResolution(double yRes)Get the y_resolution attribute in the image.MagickImagesharpenImage(double raduis, double sigma)Creates a new image that is a copy of an existing one with the pixels sharpened.MagickImageshearImage(double x_shear, double y_shear)Creates a new image that is a shear_image copy of an existing one.booleansignatureImage()Determine signature of image and place signature in the image's attributes.intsizeBlob()Returns the current length of the image file or blob.voidsolarizeImage(double threshold)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.booleansortColormapByIntensity()Sorts the colormap of a PseudoClass image by decreasing color intensity.MagickImagespreadImage(int radius)A special effects method that randomly displaces each pixel in a block defined by the radius parameter.MagickImagespreadImage(int radius, int pixelInterpolateMethod)A special effects method that randomly displaces each pixel in a block defined by the radius parameter.booleanstrip()Strips an image of all profiles and comments..MagickImageswirlImage(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.MagickImageswirlImage(double degrees, int pixelInterpolateMethod)Swirls the pixels about the center of the image, where degrees indicates the sweep of the arc through which each pixel is moved.voidsyncImage()Initializes the red, green, and blue intensities of each pixel as defined by the colormap index.voidtextureImage(MagickImage image)Layers a texture onto the background of an image.booleanthresholdImage(double threshold)Thresholds the reference image.voidtransformImage(java.lang.String cropGeometry, java.lang.String imageGeometry)Creates a new image that is a transformed size of of existing one as specified by the crop and image geometries.booleantransformImageColorspace(int colorspace)Transforms an image colorspace.booleantransformRgbImage(int colorspace)Converts the reference image from an alternate colorspace.booleantransparentImage(PixelPacket color, int opacity)Creates a matte image associated with the image.MagickImagetrimImage()Trim edges that are the background color from the image.MagickImageuniqueImageColors()Create a Nx1 pixel image where N is the number of unique colors in the image.MagickImageunsharpMaskImage(double raduis, double sigma, double amount, double threshold)Creates a new image that is a copy of an existing one with the pixels sharpened using an "unsharp" masking technique.MagickImagewaveImage(double amplitude, double wavelength)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.MagickImagewaveImage(double amplitude, double wavelength, int pixelInterpolateMethod)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.booleanwriteImage(ImageInfo imageInfo)Write the image specified in the ImageInfo object.MagickImagezoomImage(int cols, int rows)Creates a new image that is a scaled size of an existing one.-
Methods inherited from class magick.Magick
parseImageGeometry, queryFonts
-
-
-
-
Constructor Detail
-
MagickImage
public MagickImage()
Constructor.
-
MagickImage
public MagickImage(MagickImage[] images) throws MagickException
Construct a MagickImage that is made up of all the images in the specified array. If any of the images contains multiple frames, the frames are also appended to the new image. All the images are cloned.- Parameters:
images- array of images to linked- Throws:
MagickException
-
MagickImage
public MagickImage(ImageInfo imageInfo, boolean ping) throws MagickException
Constructor that also reads an image file specified in the parameter.- Parameters:
imageInfo- the ImageInfo for an image file to readping- true for ping the image only.- Throws:
MagickException- on error
-
MagickImage
public MagickImage(ImageInfo imageInfo) throws MagickException
Constructor that also reads an image file specified in the parameter.- Parameters:
imageInfo- the ImageInfo for an image file to read- Throws:
MagickException- if an error occurs
-
MagickImage
public MagickImage(ImageInfo imageInfo, byte[] blob) throws MagickException
Constructor that takes the image to be read from memory.- Parameters:
imageInfo- the ImageInfo instance for default settings, etcblob- the image to be read in memory- Throws:
MagickException- if an error occurs
-
-
Method Detail
-
pingImage
public void pingImage(ImageInfo imageInfo) throws MagickException
Pings the image.- Parameters:
imageInfo- the ImageInfo for an image file to read- Throws:
MagickException- if an error occurs- See Also:
- The underlying ImageMagick call
-
finalize
protected void finalize()
This method will clean up the handle.- Overrides:
finalizein classjava.lang.Object
-
allocateImage
public void allocateImage(ImageInfo imageInfo)
Allocate a blank image object.- Parameters:
imageInfo- specifies the parameters for the blank image
-
readImage
public void readImage(ImageInfo imageInfo) throws MagickException
Read the image specified in the ImageInfo object.- Parameters:
imageInfo- specifies the file to read from- Throws:
MagickException- on error- See Also:
- The underlying ImageMagick call
-
writeImage
public boolean writeImage(ImageInfo imageInfo) throws MagickException
Write the image specified in the ImageInfo object.- Parameters:
imageInfo- specifies the writing parameters- Returns:
- true for success, false for failure
- Throws:
MagickException- on error
-
getFileName
public java.lang.String getFileName() throws MagickExceptionReturn the image file name of the image.- Returns:
- the file name of the image
- Throws:
MagickException- on error
-
setFileName
public void setFileName(java.lang.String fileName) throws MagickExceptionSet the image file name.- Parameters:
fileName- new file name- Throws:
MagickException- on error
-
setFilter
public void setFilter(int filter) throws MagickExceptionSet the filter type.- Parameters:
filter- the filter type from constants defined in the class FilterType- Throws:
MagickException- on error- See Also:
FilterType
-
getFilter
public int getFilter() throws MagickExceptionGet the filter type.- Returns:
- the filter type as defined in the class FilterType
- Throws:
MagickException- on error- See Also:
FilterType
-
addNoiseImage
public MagickImage addNoiseImage(int noiseType) throws MagickException
Adds random noise to the image.- Parameters:
noiseType- The type of noise: Uniform, Gaussian, Multiplicative, Impulse, Laplacian, or Poisson.- Returns:
- An image with additional noise.
- Throws:
MagickException- on error- See Also:
NoiseType, The underlying ImageMagick call
-
addNoiseImage
public MagickImage addNoiseImage(int noiseType, double attenuate) throws MagickException
Adds random noise to the image.- Parameters:
noiseType- The type of noise: Uniform, Gaussian, Multiplicative, Impulse, Laplacian, or Poisson.attenuate- The random distribution.- Returns:
- An image with additional noise.
- Throws:
MagickException- on error- See Also:
NoiseType, The underlying ImageMagick call
-
getDimension
public java.awt.Dimension getDimension() throws MagickExceptionReturn the number of columns and rows of the image.- Returns:
- the dimension of the image
- Throws:
MagickException- on error
-
getDepth
public int getDepth() throws MagickExceptionReturn the depth of the image.- Returns:
- the depth of the image.
- Throws:
MagickException- on error
-
setDepth
public void setDepth(int depth) throws MagickExceptionSet the depth of the image.- Parameters:
depth- the depth of the image- Throws:
MagickException- on error
-
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.- Parameters:
raduis- The radius of the gaussian, in pixels, not counting the center pixelsigma- The standard deviation of the gaussian, in pixels- Returns:
- A blurred image.
- Throws:
MagickException- on error
-
blurImageChannel
public MagickImage blurImageChannel(int channel, 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.- Parameters:
channel- The channel(s) to which the blurring should apply (see ChannelType)raduis- The radius of the gaussian, in pixels, not counting the center pixelsigma- The standard deviation of the gaussian, in pixels- Returns:
- A blurred image.
- Throws:
MagickException- on error
-
trimImage
public MagickImage trimImage() throws MagickException
Trim edges that are the background color from the image.- Returns:
- the trimmed image
- Throws:
MagickException- on error
-
resetImagePage
public boolean resetImagePage(java.lang.String page) throws MagickExceptionResets the image page canvas and position.- Parameters:
page- String representing the new page geometry- Returns:
- true for success, false for failure
- Throws:
MagickException- on error
-
getStorageClass
public int getStorageClass() throws MagickExceptionReturn the storage class of the image.- Returns:
- the store class as defined in ClassType
- Throws:
MagickException- on error- See Also:
ClassType
-
annotateImage
public void annotateImage(DrawInfo info)
Annotates an image with test. Optionally the annotation can include the image filename, type, width, height, or scene number by embedding special format characters.- Parameters:
info- the anotation information
-
borderImage
public MagickImage borderImage(java.awt.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.- Parameters:
borderInfo- the rectangle for which border is drawn- Returns:
- an Image with a border around it
- Throws:
MagickException- on error- See Also:
setBorderColor(magick.PixelPacket),getBorderColor()
-
borderImage
public MagickImage borderImage(java.awt.Rectangle borderInfo, int compositeOperator) 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.- Parameters:
borderInfo- the rectangle for which border is drawncompositeOperator- the composite operator- Returns:
- an Image with a border around it
- Throws:
MagickException- on error- See Also:
setBorderColor(magick.PixelPacket),getBorderColor()
-
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.- Parameters:
raduis- The radius of the pixel neighborhood.sigma- The standard deviation of the gaussian, in pixels- Returns:
- A charcoal-like image.
- Throws:
MagickException- on error
-
raiseImage
public boolean raiseImage(java.awt.Rectangle raiseInfo, boolean raise) throws MagickExceptionCreates 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.- Parameters:
raiseInfo- the rectangle for which border is drawnraise- true to create raise effect, false to lower- Returns:
- true if successful, false otherwise
- Throws:
MagickException- on error
-
chopImage
public MagickImage chopImage(java.awt.Rectangle chopInfo) throws MagickException
Creates a new image that is a subregion of the original.- Parameters:
chopInfo- the rectange to chop the image- Throws:
MagickException- on error
-
colorizeImage
public MagickImage colorizeImage(java.lang.String opacity, PixelPacket target) throws MagickException
Colourises the image with a pen colour.- Parameters:
opacity- string percentage value for opacitytarget- a colour value- Returns:
- the colourised image
- Throws:
MagickException- on error
-
compositeImage
public boolean compositeImage(int compOp, MagickImage compImage, int xOff, int yOff) throws MagickExceptionComposite the image supplied onto itself at the specified offsets.- Parameters:
compOp- This operator affects how the composite is applied to the image. The operators and how they are utilized are listed here.compImage- the source imagexOff- The column offset of the composited image.yOff- The row offset of the composited image.- Throws:
MagickException- on error- See Also:
CompositeOperator, Command line explanation, The underlying ImageMagick call
-
compositeImage
public boolean compositeImage(int compOp, MagickImage compImage, boolean clipToSelf, int xOff, int yOff) throws MagickExceptionComposite the image supplied onto itself at the specified offsets.- Parameters:
compOp- This operator affects how the composite is applied to the image. The operators and how they are utilized are listed here.compImage- the source imageclipToSelf- Whether or not to limit composition to area composedxOff- The column offset of the composited image.yOff- The row offset of the composited image.- Throws:
MagickException- on error- See Also:
CompositeOperator, Command line explanation, The underlying ImageMagick call
-
coalesceImages
public MagickImage coalesceImages() throws MagickException
Composites a set of images while respecting any page offsets and disposal methods.- Returns:
- the coalesced image
- Throws:
MagickException- on error- See Also:
- The underlying ImageMagick call
-
disposeImages
public MagickImage disposeImages() throws MagickException
Returns the coalesced frames of a GIF animation as it would appear after the GIF dispose method of that frame has been applied..- Returns:
- the disposed image
- Throws:
MagickException- on error- See Also:
- The underlying ImageMagick call
-
contrastImage
public boolean contrastImage(boolean sharpen) throws MagickExceptionEnhances the intensity differences between the lighter and darker elements of the image.- Parameters:
sharpen-- Returns:
- a boolean value to indicate success
- Throws:
MagickException- on error
-
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 copy is optional.- Parameters:
columns-rows-clonePixels-- Returns:
- a cloned image
- Throws:
MagickException- on error
-
constituteImage
public void constituteImage(int width, int height, java.lang.String map, byte[] pixels) throws MagickExceptionCreate a new image of 8-bit component of the specified dimensions.- Parameters:
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- Throws:
MagickException- on error- See Also:
- The underlying ImageMagick call
-
constituteImage
public void constituteImage(int width, int height, java.lang.String map, int[] pixels) throws MagickExceptionCreate a new image of 32-bit component of the specified dimensions.- Parameters:
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- Throws:
MagickException- on error- See Also:
- The underlying ImageMagick call
-
constituteImage
public void constituteImage(int width, int height, java.lang.String map, float[] pixels) throws MagickExceptionCreate a new image of float component of the specified dimensions.- Parameters:
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- Throws:
MagickException- on error- See Also:
- The underlying ImageMagick call
-
cropImage
public MagickImage cropImage(java.awt.Rectangle chopInfo) throws MagickException
Creates a new image that is a subregion of the original.- Parameters:
chopInfo- the subimage- Returns:
- a subimage of the original
- Throws:
MagickException- on error
-
cycleColormapImage
public void cycleColormapImage(int amount) throws MagickExceptionCycles the image colormap by a specified amount.- Throws:
MagickException- on error
-
destroyImages
public void destroyImages()
Called by finalize to deallocate the image handle.
-
drawImage
public boolean drawImage(DrawInfo aInfo) throws MagickException
Draws a primitive (line, rectangle, ellipse) on the image.- Returns:
- a boolean value to indicate success
- Throws:
MagickException- on error
-
getTypeMetrics
public TypeMetric getTypeMetrics(DrawInfo info) throws MagickException
GetTypeMetrics() returns information for the specified font and text- Throws:
MagickException- on error- See Also:
- ImageMagick API: GetTypeMetrics
-
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.- Parameters:
raduis- The radius of the pixel neighborhood.- Returns:
- A new image with the edges hilighted.
- Throws:
MagickException- on error
-
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.- Parameters:
raduis- The radius of the pixel neighborhood.sigma- The standard deviation of the Gaussian, in pixels- Returns:
- A new, embossed, image.
- Throws:
MagickException- on error
-
enhanceImage
public MagickImage enhanceImage() throws MagickException
Applies a digital filter that improves the quality of a noisy image.- Returns:
- A new, enhanced, image.
- Throws:
MagickException- on error
-
equalizeImage
public boolean equalizeImage() throws MagickExceptionPerforms histogram equalization.- Returns:
- a boolean value to indicate success
- Throws:
MagickException- on error
-
flipImage
public MagickImage flipImage() throws MagickException
Creates a new image that reflects each scanline in the vertical direction.- Returns:
- a new image that has been flipped
- Throws:
MagickException- on error
-
flopImage
public MagickImage flopImage() throws MagickException
Creates a new image that reflects each scanline in the horizontal direction- Returns:
- a new image that has been flopped
- Throws:
MagickException- on error
-
gammaImage
public boolean gammaImage(java.lang.String gamma) throws MagickExceptionConverts the reference image to gamma corrected colors.- Returns:
- a boolean value to indicate success
- Throws:
MagickException- on error
-
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.- Parameters:
raduis- The radius of the Gaussian, in pixels, not counting the center pixelsigma- The standard deviation of the Gaussian, in pixels.- Returns:
- A new, blurred, image.
- Throws:
MagickException- on error
-
implodeImage
public MagickImage implodeImage(double amount) throws MagickException
Implodes the image's pixels about the center.- Parameters:
amount- Amount of implosion if positive, explosion if negative.- Returns:
- A new, imploded, image.
- Throws:
MagickException- on error
-
implodeImage
public MagickImage implodeImage(double amount, int pixelInterpolateMethod) throws MagickException
Implodes the image's pixels about the center.- Parameters:
amount- Amount of implosion if positive, explosion if negative.pixelInterpolateMethod- The pixel interpolation method.- Returns:
- A new, imploded, image.
- Throws:
MagickException- on error
-
isGrayImage
public boolean isGrayImage() throws MagickExceptionReturns True if the image is grayscale otherwise False is returned.- Returns:
- a boolean value to indicate success
- Throws:
MagickException- on error
-
isMonochromeImage
public boolean isMonochromeImage() throws MagickExceptionReturns True if the image is monochrome otherwise False is returned.- Returns:
- a boolean value to indicate success
- Throws:
MagickException- on error
-
magnifyImage
public MagickImage magnifyImage() throws MagickException
Creates a new image that is a integral size greater than an existing one.- Returns:
- a magnified image
- Throws:
MagickException- on error
-
matteFloodfillImage
public boolean matteFloodfillImage(PixelPacket target, int matte, int x, int y, int method) throws MagickException
Floodfills the designated area with a matte value.- Returns:
- a boolean value to indicate success
- Throws:
MagickException- on error
-
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.- Parameters:
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- Returns:
- true or false depending on success or failure respectively
- Throws:
MagickException- if any error occurs- See Also:
PaintMethod
-
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.- Parameters:
radius- The radius of the pixel neighborhood.- Returns:
- A new, filtered, image.
- Throws:
MagickException- on error
-
minifyImage
public MagickImage minifyImage() throws MagickException
Creates a new image that is a integral size less than an existing one.- Returns:
- a minified image
- Throws:
MagickException- on error
-
modulateImage
public boolean modulateImage(java.lang.String modulate) throws MagickExceptionModulates the hue, saturation, and brightness of an image.- Returns:
- a boolean value to indicate success
- Throws:
MagickException- on error
-
negateImage
public boolean negateImage(int grayscale) throws MagickExceptionNegates the colors in the reference image. The Grayscale option means that only grayscale values within the image are negated.- Returns:
- a boolean value to indicate success
- Throws:
MagickException- on error
-
normalizeImage
public boolean normalizeImage() throws MagickExceptionNormalizes the pixel values to span the full range of color values. This is a contrast enhancement technique.- Returns:
- a boolean value to indicate success
- Throws:
MagickException- on error
-
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.- Parameters:
radius- The radius of the pixel neighborhood.- Returns:
- A new, simulated oil-painting, image.
- Throws:
MagickException- on error
-
oilPaintImage
public MagickImage oilPaintImage(double radius, double sigma) 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.- Parameters:
radius- The radius of the pixel neighborhood.sigma- The standard deviation of the Gaussian, in pixels.- Returns:
- A new, simulated oil-painting, image.
- Throws:
MagickException- on error
-
opaqueImage
public boolean opaqueImage(PixelPacket target, PixelPacket penColor) throws MagickException
Changes the color of an opaque pixel to the pen color.- Parameters:
target- the color to search for in the imagepenColor- the color to replace it with- Returns:
- a boolean value to indicate success
- Throws:
MagickException- on error
-
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.
- Parameters:
radius- The radius of the pixel neighborhood.- Returns:
- A new, filtered, image.
- Throws:
MagickException- on error
-
rgbTransformImage
public boolean rgbTransformImage(int colorspace) throws MagickExceptionConverts 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].- Parameters:
colorspace- the target colorspace to transform to- Returns:
- a boolean value to indicate success
- Throws:
MagickException- on error
-
rollImage
public MagickImage rollImage(int xOffset, int yOffset) throws MagickException
Rolls an image vertically and horizontally.- Parameters:
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- Returns:
- the rolled image
- Throws:
MagickException- on error
-
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.- Parameters:
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- Returns:
- the sampled image
- Throws:
MagickException- on error
-
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.- Parameters:
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- Returns:
- the scaled image
- Throws:
MagickException- on error
-
resizeImage
public MagickImage resizeImage(int cols, int rows, double blur) throws MagickException
Return a new image that is a resized version of the original. If an undefined filter is given the filter defaults to Mitchell for a colormapped image, a image with a matte channel, or if the image is enlarged. Otherwise the filter defaults to a Lanczos.- Parameters:
cols- An integer that specifies the number of columns in the resized imagerows- An integer that specifies the number of rows in the resized imageblur- - The blur factor where > 1 is blurry, < 1 is sharp. Typically set this to 1.0.- Returns:
- the resized image
- Throws:
MagickException- on error
-
extentImage
public MagickImage extentImage(int cols, int rows, int gravity) throws MagickException
Return a new image that is a extended version of the original.- Parameters:
cols- An integer that specifies the number of columns in the extended imagerows- An integer that specifies the number of rows in the extended imagegravity- extent direction @see GravityType- Returns:
- the extended image
- Throws:
MagickException- on error
-
segmentImage
public int segmentImage(int colorspace, double cluster_threshold, double smoothing_threshold) throws MagickExceptionSegment an image by analyzing the histograms of the color components and identifying units that are homogeneous using the fuzzy c-means technique.- Parameters:
colorspace- AColorspaceTypevalue 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.- Returns:
- The actual number of colors allocated in the colormap.
- Throws:
MagickException- on error- See Also:
ColorspaceType
-
solarizeImage
public void solarizeImage(double threshold) throws MagickExceptionApplies 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:
threshold- Ranges from 0 to MaxRGB and is a measure of the extent of the solarization.- Throws:
MagickException- on error
-
setColorFuzz
public void setColorFuzz(double fuzz) throws MagickExceptionSet color fuzz- Parameters:
fuzz- fuzz value.- Throws:
MagickException- on error
-
getBoundingBox
public java.awt.Rectangle getBoundingBox() throws MagickExceptionGet bounding box- Throws:
MagickException- on error
-
sortColormapByIntensity
public boolean sortColormapByIntensity() throws MagickExceptionSorts the colormap of a PseudoClass image by decreasing color intensity.- Returns:
- a boolean value indicating success
- Throws:
MagickException- on error
-
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.- Parameters:
radius- Choose a random pixel in a neighborhood of this extent.- Returns:
- A new, spread, image.
- Throws:
MagickException- on error
-
spreadImage
public MagickImage spreadImage(int radius, int pixelInterpolateMethod) throws MagickException
A special effects method that randomly displaces each pixel in a block defined by the radius parameter.- Parameters:
radius- Choose a random pixel in a neighborhood of this extent.pixelInterpolateMethod- The pixel interpolation method.- Returns:
- A new, spread, image.
- Throws:
MagickException- on error
-
swirlImage
public MagickImage swirlImage(double degrees) 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.- Parameters:
degrees- Defines the tightness of the swirling effect.- Returns:
- A new, swirled, image.
- Throws:
MagickException- on error
-
swirlImage
public MagickImage swirlImage(double degrees, int pixelInterpolateMethod) 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.- Parameters:
degrees- Defines the tightness of the swirling effect.pixelInterpolateMethod- The pixel interpolation method.- Returns:
- A new, swirled, image.
- Throws:
MagickException- on error
-
syncImage
public void syncImage() throws MagickExceptionInitializes the red, green, and blue intensities of each pixel as defined by the colormap index.- Throws:
MagickException- on error
-
textureImage
public void textureImage(MagickImage image) throws MagickException
Layers a texture onto the background of an image.- Parameters:
image- the image to use for texture- Throws:
MagickException- on error
-
thresholdImage
public boolean thresholdImage(double threshold) throws MagickExceptionThresholds the reference image.- Parameters:
threshold- the threshold value- Returns:
- a boolean value indicating success
- Throws:
MagickException- on error
-
transformImage
public void transformImage(java.lang.String cropGeometry, java.lang.String imageGeometry) throws MagickExceptionCreates 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.- Parameters:
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.- Throws:
MagickException- on error
-
transformRgbImage
public boolean transformRgbImage(int colorspace) throws MagickExceptionConverts 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].- Parameters:
colorspace- An unsigned integer value defines which \ colorspace to transform the image from- Returns:
- a boolean value indicating success
- Throws:
MagickException- on error
-
transparentImage
public boolean transparentImage(PixelPacket color, int opacity) throws MagickException
Creates a matte image associated with the image.- Parameters:
color- The color to search for in the imageopacity- The opacity of the transparent image- Returns:
- a boolean value indicating success
- Throws:
MagickException- on error
-
uniqueImageColors
public MagickImage uniqueImageColors() throws MagickException
Create a Nx1 pixel image where N is the number of unique colors in the image. Each pixel in the output image is the color of one of the unique colors of the original image.- Throws:
MagickException
-
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.
- Parameters:
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.- Returns:
- A sharpened image.
- Throws:
MagickException- on error
-
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.- Parameters:
amplitude- Define the amplitude of the sine wave.wavelength- Define the wave-length of the sine wave.- Returns:
- A new, "waved", image.
- Throws:
MagickException- on error
-
waveImage
public MagickImage waveImage(double amplitude, double wavelength, int pixelInterpolateMethod) 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.- Parameters:
amplitude- Define the amplitude of the sine wave.wavelength- Define the wave-length of the sine wave.pixelInterpolateMethod- The pixel interpolation method.- Returns:
- A new, "waved", image.
- Throws:
MagickException- on error
-
zoomImage
public MagickImage zoomImage(int cols, int rows) throws MagickException
Creates a new image that is a scaled size of an existing one.- Returns:
- the zoomed image
- Throws:
MagickException- on error
-
dispatchImage
public boolean dispatchImage(int x, int y, int width, int height, java.lang.String map, byte[] pixels) throws MagickExceptionGet the pixels as 8-bit components from the image.- Parameters:
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- Returns:
- a boolean value indicating success
- Throws:
MagickException- on error
-
dispatchImage
public boolean dispatchImage(int x, int y, int width, int height, java.lang.String map, int[] pixels) throws MagickExceptionGet the pixels as 32-bit components from the image.- Parameters:
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- Returns:
- a boolean value indicating success
- Throws:
MagickException- on error
-
dispatchImage
public boolean dispatchImage(int x, int y, int width, int height, java.lang.String map, float[] pixels) throws MagickExceptionGet the pixels as float components from the image.- Parameters:
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- Returns:
- a boolean value indicating success
- Throws:
MagickException- on error
-
getMagick
public java.lang.String getMagick() throws MagickExceptionReturn the image format (i.e., Gif, Jpeg,...)- Returns:
- the string representing the image format
- Throws:
MagickException- on error
-
getImageFormat
public java.lang.String getImageFormat() throws MagickException- Throws:
MagickException
-
setMagick
public void setMagick(java.lang.String imageFormat) throws MagickException- Throws:
MagickException
-
setImageFormat
public void setImageFormat(java.lang.String imageFormat) throws MagickException- Throws:
MagickException
-
getNumberColors
public int getNumberColors() throws MagickExceptionReturn the number of unique colors in an image.- Returns:
- the number of unique colors
- Throws:
MagickException- on error
-
setNumberColors
public void setNumberColors(int numberColors) throws MagickException- Throws:
MagickException
-
isAnimatedImage
public boolean isAnimatedImage() throws MagickExceptionReturns True if the Gif image is Animated otherwise False is returned.- Returns:
- a boolean value representing the animated status of the image
- Throws:
MagickException- on error
-
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).- Parameters:
degrees- angle of rotation.- Returns:
- A image that is a rotation of self
- Throws:
MagickException- on error
-
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).- Parameters:
x_shear- x direction shear amounty_shear- y direction shear amount- Returns:
- a sheared image constructor from self.
- Throws:
MagickException- on error
-
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.- Parameters:
quantizeInfo- contains parameters for quantization- Returns:
- a boolean value indicating success of the process
- Throws:
MagickException- on error
-
setGrayscale
public void setGrayscale() throws MagickExceptionDeprecated.Use QuantizeInfo with MagickImage.quantizeImage to acheive the same effect.Convert any colored image to grayscale.- Throws:
MagickException- on error
-
getColorspace
public int getColorspace() throws MagickExceptionGet the colorspace of the image.- Returns:
- the colorspace as defined in ColorspaceType
- Throws:
MagickException- on error- See Also:
ColorspaceType
-
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.- Parameters:
raduis- The radius of the gaussian, in pixels, not counting \ the center pixelsigma- The standard deviation of the gaussian, in pixels- Returns:
- a sharpened image.
- Throws:
MagickException- on error
-
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.- Returns:
- a despeckled image
- Throws:
MagickException- on error
-
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.- Parameters:
order- The number of columns and rows in the filter kernel.kernel- An array of double representing the convolution kernel- Returns:
- a convoled image
- Throws:
MagickException- on error
-
getImageAttribute
public java.lang.String getImageAttribute(java.lang.String key) throws MagickExceptionSearches the list of image attributes and returns the value of the attribute if it exists otherwise null.- Parameters:
key- the key of the attribute- Returns:
- the value of the attribute if exists, otherwise, null.
- Throws:
MagickException- on error
-
setImageAttribute
public boolean setImageAttribute(java.lang.String key, java.lang.String value) throws MagickExceptionSearches 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.- Parameters:
key- the key of the attributevalue- the value of the attribute- Returns:
- true if the attribute is replace or false if added
- Throws:
MagickException- on error
-
blobToImage
public void blobToImage(ImageInfo imageInfo, byte[] blob) throws MagickException
Takes from memory an image in a known format and read it into itself.- Parameters:
imageInfo- a ImageInfo instanceblob- memory containing an image in a known format- Throws:
MagickException- on error
-
imageToBlob
public byte[] imageToBlob(ImageInfo imageInfo)
Returns an array that contents the image format.- Parameters:
imageInfo- the magick member of this object determines output format- Returns:
- a byte array containing the image in the specified format
-
imagesToBlob
public byte[] imagesToBlob(ImageInfo imageInfo)
Returns the image sequence as a blob and its length.- Parameters:
imageInfo- the magick member of this object determines output format- Returns:
- a byte array containing the image in the specified format
-
setUnits
public void setUnits(int resolutionType) throws MagickExceptionSet the units attribute of the image.- Parameters:
resolutionType- the resolution type as defined in ResolutionType- Throws:
MagickException- on error- See Also:
ResolutionType
-
getUnits
public int getUnits() throws MagickExceptionGet the units attribute of the image.- Returns:
- A integer representing the resolution type as defined in ResolutionType
- Throws:
MagickException- on error- See Also:
ResolutionType
-
setXResolution
public void setXResolution(double xRes) throws MagickExceptionSet the x_resolution attribute in the image.- Parameters:
xRes- x_resolution value- Throws:
MagickException- on error
-
getXResolution
public double getXResolution() throws MagickExceptionGet the x_resolution attribute in the image.- Returns:
- x_resolution value
- Throws:
MagickException- on error
-
setYResolution
public void setYResolution(double yRes) throws MagickExceptionGet the y_resolution attribute in the image.- Parameters:
yRes- y_resolution value- Throws:
MagickException- on error
-
getYResolution
public double getYResolution() throws MagickExceptionGet the y_resolution attribute in the image.- Returns:
- y_resolution value
- Throws:
MagickException- on error
-
nextImage
protected MagickImage nextImage() throws MagickException
Return image object for next image in sequence of frames. Also sets the next image pointer to NULL.- Returns:
- next image or null if end of list.
- Throws:
MagickException- on error
-
hasFrames
public boolean hasFrames() throws MagickExceptionCheck if the image has multiple frames.- Returns:
- true if the image has multiple frames, false, otherwise.
- Throws:
MagickException- on error
-
getNumFrames
public int getNumFrames() throws MagickException- Throws:
MagickException
-
breakFrames
public MagickImage[] breakFrames() throws MagickException
Destructively create array of image frames. Contains this image as the first object and frames in sequence.- Returns:
- an array of image frame
- Throws:
MagickException- on error
-
setColorProfile
public void setColorProfile(ProfileInfo profile) throws MagickException
Set a new color profile for the image.- Parameters:
profile- a new color profile. This parameter cannot be null. Note: The profile.name attribute is ignored- Throws:
MagickException- if an error occurs- See Also:
profileImage(java.lang.String, byte[])
-
getColorProfile
public ProfileInfo getColorProfile() throws MagickException
Obtain the color profile from the image.- Returns:
- the color profile of the image
- Throws:
MagickException- if an error occurs- See Also:
profileImage(java.lang.String, byte[])
-
setIptcProfile
public void setIptcProfile(ProfileInfo profile) throws MagickException
Set a new IPTC profile for the image.- Parameters:
profile- a new IPTC profile. This parameter cannot be null. Note: The profile.name attribute is ignored- Throws:
MagickException- if an error occurs- See Also:
profileImage(java.lang.String, byte[])
-
getIptcProfile
public ProfileInfo getIptcProfile() throws MagickException
Obtain the IPTC profile from the image.- Returns:
- the IPTC profile of the image
- Throws:
MagickException- if an error occurs- See Also:
profileImage(java.lang.String, byte[])
-
getGenericProfileCount
public int getGenericProfileCount() throws MagickExceptionDeprecated.No longer works (after ImageMagick 5.5.7 ?)Return the number of generic profiles.- Returns:
- number of generic profiles
- Throws:
MagickException- if the profile count cannot be retrieved
-
getGenericProfile
public ProfileInfo getGenericProfile(int i) throws MagickException
Deprecated.No longer works (after ImageMagick 5.5.7 ?)Return the generic profile specified by the index.- Parameters:
i- the index of the generic profile to retrieve- Returns:
- a generic ProfileInfo if found, null otheriwse.
- Throws:
MagickException- if an error occurs
-
profileImage
public boolean profileImage(java.lang.String profileName, byte[] profileData) throws MagickExceptionProfileImage 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.- Parameters:
profileName- name of profile to add or removeprofileData- contents of the profile- Returns:
- Returns a true if the profile is successfully added or removed
- Throws:
MagickException- if an error occurs
-
setImageProfile
public boolean setImageProfile(java.lang.String profileName, byte[] profileData) throws MagickExceptionSetImageProfile() adds a named profile to the image. If a profile with the same name already exists, it is replaced. This method differs from the ProfileImage() method in that it does not apply CMS color profiles.- Parameters:
profileName- the profile name, for example icc, exif, and 8bim (8bim is the Photoshop wrapper for iptc profiles).profileData- contents of the profile- Returns:
- Returns a true if the profile is successfully set
- Throws:
MagickException- if an error occurs- Since:
- JMagick 6.3.9
- See Also:
- The ImageMagick SetImageProfile documentation
-
getImageProfile
public byte[] getImageProfile(java.lang.String profileName) throws MagickExceptionGetImageProfile() gets a profile associated with an image by name.- Parameters:
profileName- name of profile get- Returns:
- contents of the profile
- Throws:
MagickException- if an error occurs- Since:
- JMagick 6.3.9
- See Also:
- The ImageMagick GetImageProfile documentation
-
getNextImageProfile
public java.lang.String getNextImageProfile() throws MagickExceptionGetNextImageProfile() gets the next profile name associated with an image.- Returns:
- the profile name
- Throws:
MagickException- if an error occurs- See Also:
- The ImageMagick GetNextImageProfile documentation
-
resetImageProfileIterator
public void resetImageProfileIterator() throws MagickExceptionResets the image profile iterator.- Throws:
MagickException- if an error occurs
-
montageImages
public MagickImage montageImages(MontageInfo montageInfo) throws MagickException
Create a montage of all the images in the list.- Parameters:
montageInfo- parameter used in the creation of the montage- Returns:
- a montage of all images in the list
- Throws:
MagickException- if an error occurs
-
autoOrientImage
public MagickImage autoOrientImage() throws MagickException
This operator reads and resets the EXIF image profile setting 'Orientation' and then performs the appropriate 90 degree rotation on the image to orient the image, for correct viewing.- Returns:
- a new image operated
- Throws:
MagickException- upon errors
-
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.- Returns:
- an image with the pixel component of each image averaged.
- Throws:
MagickException- upon errors
-
levelImage
public boolean levelImage(java.lang.String levels) throws MagickExceptionAdjusts the levels of an image given these points: black, mid, and white.- Parameters:
levels- String representing the black, mid and white levels- Returns:
- true if successful, false otherwise.
- Throws:
MagickException
-
sizeBlob
public int sizeBlob() throws MagickExceptionReturns the current length of the image file or blob.- Returns:
- current length of the image file or blob
- Throws:
MagickException
-
setCompression
public void setCompression(int value) throws MagickExceptionSet the compression attribute. This will affect a following call to writeImage- Parameters:
value- a value from CompressionType- Throws:
MagickException- on error- See Also:
writeImage(magick.ImageInfo),CompressionType, Command line explanation
-
getCompression
public int getCompression() throws MagickExceptionGet the CompressionType of the image.- Returns:
- the compression as defined in CompressionType
- Throws:
MagickException- on error- See Also:
CompressionType
-
getImageType
public int getImageType() throws MagickExceptionGet the image type from the MagickImage- Throws:
MagickException- See Also:
ImageType
-
setBorderColor
public void setBorderColor(PixelPacket color) throws MagickException
Set the border colour for the method borderImage.- Parameters:
color- the border colour- Throws:
MagickException- on error- See Also:
borderImage(java.awt.Rectangle)
-
getBorderColor
public PixelPacket getBorderColor() throws MagickException
Get the current border colour used by method borderImage.- Returns:
- the current border colour
- Throws:
MagickException- on error- See Also:
borderImage(java.awt.Rectangle)
-
setBackgroundColor
public void setBackgroundColor(PixelPacket color) throws MagickException
Set the background colour.- Parameters:
color- the background colour- Throws:
MagickException- on error
-
getBackgroundColor
public PixelPacket getBackgroundColor() throws MagickException
Get the current background colour.- Returns:
- the current background colour
- Throws:
MagickException- on error
-
setDelay
public void setDelay(int delay) throws MagickExceptionSet 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.- Parameters:
delay- the time delay in 1/100th of a second- Throws:
MagickException- upon error
-
getDelay
public int getDelay() throws MagickExceptionGet 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.- Returns:
- the current time delay in 1/100th of a second
- Throws:
MagickException- upon error
-
setDispose
public void setDispose(int dispose) throws MagickExceptionSet 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.- Parameters:
dispose- the disposal method for GIF animation- Throws:
MagickException- upon error
-
getDispose
public int getDispose() throws MagickExceptionGet 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.- Returns:
- the current disposal method for GIF animation
- Throws:
MagickException- upon error
-
setIterations
public void setIterations(int iterations) throws MagickExceptionSet the number of iterations to loop an animation (e.g. Netscape loop extension) for.- Parameters:
iterations- the number of iterations- Throws:
MagickException- upon error
-
getIterations
public int getIterations() throws MagickExceptionGet the number of iterations to loop an animation (e.g. Netscape loop extension) for.- Returns:
- the current number of iterations
- Throws:
MagickException- upon error
-
getColors
public int getColors() throws MagickExceptionThe number of colors in the colourmap.- Returns:
- the current number of colors in the image
- Throws:
MagickException- upon error- See Also:
quantizeImage(magick.QuantizeInfo)
-
getTotalColors
public int getTotalColors() throws MagickExceptionGet the The number of colors in the image after QuantizeImage(), or QuantizeImages().- Returns:
- the current number of colors in the image
- Throws:
MagickException- upon error
-
getColormap
public PixelPacket getColormap(int index) throws MagickException
Get the colour specified by the index.- Parameters:
index- the index for which to return a colour- Returns:
- the colour of the index
- Throws:
MagickException- upon error
-
getColormap
public PixelPacket[] getColormap() throws MagickException
Get the entire colour map.- Returns:
- the colour map of the image
- Throws:
MagickException- upon error
-
getOnePixel
public PixelPacket getOnePixel(int x, int y) throws MagickException
Get the colour at the specified row and column- Parameters:
x- the x position of the pixel to fetchy- the y position of the pixel to fetch- Returns:
- the colour of the index
- Throws:
MagickException- upon error
-
signatureImage
public boolean signatureImage() throws MagickExceptionDetermine signature of image and place signature in the image's attributes.- Returns:
- true if successful, false, otherwise
- Throws:
MagickException- on error
-
getQuality
public int getQuality() throws MagickException- Returns:
- the quality the image was saved
- Throws:
MagickException- on error
-
setQuality
public void setQuality(int value) throws MagickException- Throws:
MagickException
-
setRenderingIntent
public void setRenderingIntent(int renderingIntent) throws MagickExceptionSet the intent attribute of the image.- Parameters:
renderingIntent- the rendering Intent type as defined in RenderingIntent- Throws:
MagickException- on error- See Also:
RenderingIntent
-
getRenderingIntent
public int getRenderingIntent() throws MagickExceptionGet the intent attribute of the image.- Returns:
- A integer representing the rendering Intent type as defined in RenderingIntent
- Throws:
MagickException- on error
-
setMatte
public void setMatte(boolean matte) throws MagickExceptionSet the matte attribute of the image.- Parameters:
matte- the matte value- Throws:
MagickException- on error
-
getMatte
public boolean getMatte() throws MagickExceptionGet the matte attribute of the image.- Returns:
- A boolean representing the value of the matte attribute
- Throws:
MagickException- on error
-
getNumberImages
public int getNumberImages() throws MagickExceptionGet the number of images- Returns:
- number of images
- Throws:
MagickException
-
strip
public boolean strip() throws MagickExceptionStrips an image of all profiles and comments..- Throws:
MagickException- on error
-
formatMagickCaption
public TypeMetric formatMagickCaption(int maxWidth, DrawInfo draw_info, java.lang.StringBuilder caption) throws MagickException
formatMagickCaption in fact does not need an Image Object- Parameters:
maxWidth-draw_info- the draw info. (text field is changed)caption- the caption, newlines are inserted- Returns:
- output String
- Throws:
MagickException- See Also:
- The ImageMagick FormatMagickCaption documentation
-
formatMagickCaption
public TypeMetric formatMagickCaption(int maxWidth, int indent2ndLine, boolean trimLineEnds, DrawInfo draw_info, java.lang.StringBuilder caption) throws MagickException
- Parameters:
maxWidth-indent2ndLine-trimLineEnds- if line ends with "xyz \n" line might be wrapped at the first space, " \n" will produce an empty line - that option deletes whitespaces before \ndraw_info- the draw info. (text field is changed)caption- the caption, newlines are inserted- Returns:
- Throws:
MagickException
-
setImageColorspace
public boolean setImageColorspace(int colorspace) throws MagickExceptionSets the colorspace member of the Image structure.- Parameters:
colorspace- An unsigned integer value defines which \ colorspace to transform the image to- Returns:
- a boolean value indicating success
- Throws:
MagickException- on error
-
resizeImage
public MagickImage resizeImage(int cols, int rows, int filter, double blur) throws MagickException
Return a new image that is a resized version of the original, with the specified filter applied. 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.- Parameters:
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- Returns:
- the scaled image
- Throws:
MagickException- on error
-
transformImageColorspace
public boolean transformImageColorspace(int colorspace) throws MagickExceptionTransforms an image colorspace.- Parameters:
colorspace- An unsigned integer value defines which \ colorspace to transform the image to- Returns:
- a boolean value indicating success
- Throws:
MagickException- on error
-
deconstructImages
public MagickImage deconstructImages() throws MagickException
- Throws:
MagickException
-
optimizeLayer
public MagickImage optimizeLayer(ImageInfo imageInfo) throws MagickException
- Throws:
MagickException
-
-