public class ImageUtilities extends Object
| Constructor and Description |
|---|
ImageUtilities() |
| Modifier and Type | Method and Description |
|---|---|
static BufferedImage |
createImageARGB(Image src,
boolean copy)
Returns a
BufferedImage with type ARGB based on the supplied source image |
static BufferedImage |
createImageARGB(int width,
int height)
Returns a
BufferedImage with type ARGB based on the supplied param |
static String |
getFileSuffix(File file)
Return file suffix portion of give file.
|
static BufferedImage |
getScaledInstance(BufferedImage img,
int width,
int height,
boolean autoHint,
boolean scaleFit)
Return a scaled instance of the provided
BufferedImage. |
static BufferedImage |
getScaledInstance(BufferedImage img,
int width,
int height,
Object hint)
Return a scaled instance of the provided
BufferedImage. |
static BufferedImage |
getScaledInstance(BufferedImage img,
int width,
int height,
Object hint,
boolean scaleFit)
Return a scaled instance of the provided
BufferedImage. |
static BufferedImage |
iconToBufferedImage(Icon icon)
Returns a
BufferedImage representation of the icon. |
static boolean |
isFileImage(File file)
Return whether the file is a known image file or not
It is use
ImageIO to determine the file type |
static double |
scaleToFit(Dimension src,
Dimension dest)
Return the scale value from
src to dest proportionally |
public static BufferedImage getScaledInstance(BufferedImage img, int width, int height, Object hint)
BufferedImage.
Only a wrapper for getScaledInstance(BufferedImage,int,int,Object,false)img - the original image to be scaledwidth - target widthheight - target heighthint - one of the rendering hints that corresponds to
RenderingHints.KEY_INTERPOLATION (e.g.
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR,
RenderingHints.VALUE_INTERPOLATION_BILINEAR,
RenderingHints.VALUE_INTERPOLATION_BICUBIC)BufferedImagegetScaledInstance(BufferedImage,int,int,boolean,boolean),
getScaledInstance(BufferedImage,int,int,Object,boolean)public static BufferedImage getScaledInstance(BufferedImage img, int width, int height, boolean autoHint, boolean scaleFit)
BufferedImage.img - the imagewidth - target widthheight - target heightautoHint - if scale factor > 0.5 use bicubic else use default.scaleFit - scale the image proportionally to fit the supplied width & height
if the image is smaller than width and height then nothing changeBufferedImagegetScaledInstance(BufferedImage,int,int,Object),
getScaledInstance(BufferedImage,int,int,Object,boolean)public static BufferedImage getScaledInstance(BufferedImage img, int width, int height, Object hint, boolean scaleFit)
BufferedImage.img - the imagewidth - target widthheight - target heighthint - one of the rendering hints that corresponds to
RenderingHints.KEY_INTERPOLATION (e.g.
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR,
RenderingHints.VALUE_INTERPOLATION_BILINEAR,
RenderingHints.VALUE_INTERPOLATION_BICUBIC)scaleFit - scale the image proportionally to fit the supplied width & height
if the image is smaller than width and height then nothing changeBufferedImagegetScaledInstance(BufferedImage,int,int,Object),
getScaledInstance(BufferedImage,int,int,boolean,boolean),
scaleToFit(Dimension,Dimension)public static double scaleToFit(Dimension src, Dimension dest)
src to dest proportionallysrc - source dimensiondest - destination dimensionpublic static boolean isFileImage(File file)
ImageIO to determine the file typefile - the file to be queriedpublic static String getFileSuffix(File file)
file - the file to be queriedpublic static BufferedImage iconToBufferedImage(Icon icon)
BufferedImage representation of the icon.icon - the iconBufferedImage representation of the iconpublic static BufferedImage createImageARGB(Image src, boolean copy)
BufferedImage with type ARGB based on the supplied source imagesrc - Imagecopy - if true copy the content of the sourceBufferedImagepublic static BufferedImage createImageARGB(int width, int height)
BufferedImage with type ARGB based on the supplied paramwidth - the widthheight - the heightBufferedImage