Package net.sourceforge.tess4j.util
Class ImageHelper
java.lang.Object
net.sourceforge.tess4j.util.ImageHelper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BufferedImage
Clones an image.static BufferedImage
convertImage2Binary
(BufferedImage image) Deprecated.static BufferedImage
A simple method to convert an image to binary or B/W image.static BufferedImage
A simple method to convert an image to gray scale.static Image
Gets an image from Clipboard.static BufferedImage
getScaledInstance
(BufferedImage image, int targetWidth, int targetHeight) Convenience method that returns a scaled instance of the providedBufferedImage
.static IIOImage
getScaledInstance
(IIOImage iioSource, float scale) Convenience method that returns a scaled instance of the providedIIOImage
.static BufferedImage
getSubImage
(BufferedImage image, int x, int y, int width, int height) A replacement for the standardBufferedImage.getSubimage
method.static BufferedImage
invertImageColor
(BufferedImage image) Inverts image color.static BufferedImage
rotateImage
(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.getSubimage
method.- 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)