public class Image
extends java.lang.Object
Constructor and Description |
---|
Image() |
Modifier and Type | Method and Description |
---|---|
static java.awt.image.BufferedImage |
copy(java.awt.image.BufferedImage bi) |
static java.awt.image.BufferedImage |
file2Image(java.io.File file) |
static java.awt.image.BufferedImage |
file2Image(java.lang.String filename) |
static java.awt.image.BufferedImage |
getScaledInstance(java.awt.image.BufferedImage img,
int targetWidth,
int targetHeight) |
static java.awt.image.BufferedImage |
getScaledInstance(java.awt.image.BufferedImage img,
int targetWidth,
int targetHeight,
java.lang.Object hint,
boolean higherQuality)
From https://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html
Convenience method that returns a scaled instance of the
provided
BufferedImage . |
static void |
image2File(java.awt.image.BufferedImage bi,
java.io.File file) |
static void |
image2File(java.awt.image.BufferedImage bi,
java.lang.String filename) |
static java.awt.image.BufferedImage |
url2Image(java.net.URL url) |
public static java.awt.image.BufferedImage file2Image(java.lang.String filename)
public static java.awt.image.BufferedImage file2Image(java.io.File file)
public static void image2File(java.awt.image.BufferedImage bi, java.lang.String filename)
public static void image2File(java.awt.image.BufferedImage bi, java.io.File file)
public static java.awt.image.BufferedImage url2Image(java.net.URL url)
public static java.awt.image.BufferedImage copy(java.awt.image.BufferedImage bi)
public static java.awt.image.BufferedImage getScaledInstance(java.awt.image.BufferedImage img, int targetWidth, int targetHeight)
public static java.awt.image.BufferedImage getScaledInstance(java.awt.image.BufferedImage img, int targetWidth, int targetHeight, java.lang.Object hint, boolean higherQuality)
BufferedImage
.img
- the original image to be scaledtargetWidth
- the desired width of the scaled instance,
in pixelstargetHeight
- the desired height of the scaled instance,
in pixelshint
- 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
)higherQuality
- if true, this method will use a multi-step
scaling technique that provides higher quality than the usual
one-step technique (only useful in downscaling cases, where
targetWidth
or targetHeight
is
smaller than the original dimensions, and generally only when
the BILINEAR
hint is specified)BufferedImage