Package net.sourceforge.tess4j.util
Class ImageHelper
java.lang.Object
net.sourceforge.tess4j.util.ImageHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImageClones an image.static BufferedImageconvertImage2Binary(BufferedImage image) Deprecated.static BufferedImageA simple method to convert an image to binary or B/W image.static BufferedImageA simple method to convert an image to gray scale.static ImageGets an image from Clipboard.static BufferedImagegetScaledInstance(BufferedImage image, int targetWidth, int targetHeight) Convenience method that returns a scaled instance of the providedBufferedImage.static IIOImagegetScaledInstance(IIOImage iioSource, float scale) Convenience method that returns a scaled instance of the providedIIOImage.static BufferedImagegetSubImage(BufferedImage image, int x, int y, int width, int height) A replacement for the standardBufferedImage.getSubimagemethod.static BufferedImageinvertImageColor(BufferedImage image) Inverts image color.static BufferedImagerotateImage(BufferedImage image, double angle) Rotates an image.
-
Constructor Details
-
ImageHelper
public ImageHelper()
-
-
Method Details
-
getScaledInstance
public static BufferedImage getScaledInstance(BufferedImage image, int targetWidth, int targetHeight) Convenience method that returns a scaled instance of the providedBufferedImage.- Parameters:
image- the original image to be scaledtargetWidth- the desired width of the scaled instance, in pixelstargetHeight- the desired height of the scaled instance, in pixels- Returns:
- a scaled version of the original
BufferedImage
-
getScaledInstance
Convenience method that returns a scaled instance of the providedIIOImage.- Parameters:
iioSource- the original image to be scaledscale- the desired scale- Returns:
- a scaled version of the original
IIOImage
-
getSubImage
A replacement for the standardBufferedImage.getSubimagemethod.- Parameters:
image-x- the X coordinate of the upper-left corner of the specified rectangular regiony- the Y coordinate of the upper-left corner of the specified rectangular regionwidth- the width of the specified rectangular regionheight- the height of the specified rectangular region- Returns:
- a BufferedImage that is the subimage of
image.
-
convertImageToBinary
A simple method to convert an image to binary or B/W image.- Parameters:
image- input image- Returns:
- a monochrome image
-
convertImage2Binary
Deprecated.As of release 1.1, renamed toconvertImageToBinary(BufferedImage image)A simple method to convert an image to binary or B/W image.- Parameters:
image- input image- Returns:
- a monochrome image
-
convertImageToGrayscale
A simple method to convert an image to gray scale.- Parameters:
image- input image- Returns:
- a monochrome image
-
invertImageColor
Inverts image color.- Parameters:
image- input image- Returns:
- an inverted-color image
-
rotateImage
Rotates an image.- Parameters:
image- the original imageangle- the degree of rotation- Returns:
- a rotated image
-
getClipboardImage
Gets an image from Clipboard.- Returns:
- image
-
cloneImage
Clones an image. http://stackoverflow.com/questions/3514158/how-do-you-clone-a-bufferedimage- Parameters:
bi-- Returns:
-
convertImageToBinary(BufferedImage image)