|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jalios.io.ImageUtil
public class ImageUtil
Utility class to manipulate image.
Field Summary | |
---|---|
static String |
REVISION
|
Constructor Summary | |
---|---|
ImageUtil()
|
Method Summary | |
---|---|
static File |
createGIFThumbnail(File imageFile,
int maxWidth,
int maxHeight)
Creates a thumbnail of the given file image in a temporary location in the GIF format, return the corresponding File. |
static File |
createJPEGThumbnail(File imageFile,
int maxWidth,
int maxHeight)
Creates a thumbnail of the given file image in a temporary location in the JPEG format, return the corresponding File. |
static File |
createThumbnail(File imageFile,
ImageFormat format,
int maxWidth,
int maxHeight)
|
static File |
createThumbnail(File imageFile,
ImageFormat format,
int maxWidth,
int maxHeight,
String background)
Creates a thumbnail of the given file image in a temporary location in the given format, return the corresponding File. |
static String[] |
getSupportedReadFormat()
|
static String[] |
getSupportedWriteFormat()
|
static boolean |
isImage(File file)
Detects if the given file is an image file, using its extension. |
static BufferedImage |
readImage(File file)
Read the given image file and return the BufferedImage |
static BufferedImage |
resizeImage(BufferedImage image,
int maxWidth,
int maxHeight,
boolean doNotEnlarge,
String background)
Resizes the given BufferedImage to a new BufferedImage file with the given sizes. |
static File |
writeGIF(BufferedImage image,
File outFile)
Write the given BufferedImage to the given outfile in GIF format. |
static File |
writeJPEG(BufferedImage image,
File outFile)
Write the given BufferedImage to the given outfile in JPEG format. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String REVISION
Constructor Detail |
---|
public ImageUtil()
Method Detail |
---|
public static boolean isImage(File file)
file
- the file to check
public static File createGIFThumbnail(File imageFile, int maxWidth, int maxHeight)
imageFile
- the image file of which to make a thumbnail.maxWidth
- the maximum width of the output imagemaxHeight
- the maximum height of the output image
createThumbnail(File, ImageFormat, int, int)
public static File createJPEGThumbnail(File imageFile, int maxWidth, int maxHeight)
imageFile
- the image file of which to make a thumbnail.maxWidth
- the maximum width of the output imagemaxHeight
- the maximum height of the output image
createThumbnail(File, ImageFormat, int, int)
public static File createThumbnail(File imageFile, ImageFormat format, int maxWidth, int maxHeight)
createThumbnail(File, ImageFormat, int, int, String)
public static File createThumbnail(File imageFile, ImageFormat format, int maxWidth, int maxHeight, String background)
imageFile
- the image file of which to make a thumbnail.format
- the image format to use, ImageFormat.GIF
, ImageFormat.JPEG
,
if null the ImageFormat.JPEG
format is usedmaxWidth
- the maximum width of the output imagemaxHeight
- the maximum height of the output imagebackground
- the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeight
public static BufferedImage readImage(File file)
file
- the image file to read
IllegalArgumentException
- if file is null.public static BufferedImage resizeImage(BufferedImage image, int maxWidth, int maxHeight, boolean doNotEnlarge, String background)
image
- the image to resize.maxWidth
- the maximum width of the output imagemaxHeight
- the maximum height of the output imagedoNotEnlarge
- do not increase image size if image is smaller than given maximum dimension.background
- the background color (eg "FFFFFF") if sets the image dimension will be set maxWidth and maxHeight
IllegalArgumentException
- if image is null.public static File writeJPEG(BufferedImage image, File outFile)
image
- the BufferedImage to write to a file.outFile
- the file in which to write the image
IllegalArgumentException
- if image or outFile is null.public static File writeGIF(BufferedImage image, File outFile)
image
- the BufferedImage to write to a file.outFile
- the file in which to write the image
IllegalArgumentException
- if image or outFile is null.public static String[] getSupportedReadFormat()
ImageIO.getReaderFormatNames()
public static String[] getSupportedWriteFormat()
ImageIO.getWriterFormatNames()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |