public final class ImageUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static BufferedImage |
depalettize(BufferedImage img,
int maxBytes)
Convert an image to a direct color map
|
static BufferedImage |
getScaledInstance(BufferedImage img,
int targetWidth,
int targetHeight,
Object hint,
boolean higherQuality,
int imageType)
Convenience method that returns a scaled instance of the
provided
BufferedImage. |
static boolean |
isOpaque(BufferedImage img)
Check if an image is completely opaque
|
static BufferedImage |
palettize(BufferedImage img,
int maxEntries)
Convert an image to a palletized one.
|
public static BufferedImage palettize(BufferedImage img, int maxEntries)
public static BufferedImage depalettize(BufferedImage img, int maxBytes)
public static boolean isOpaque(BufferedImage img)
public static BufferedImage getScaledInstance(BufferedImage img, int targetWidth, int targetHeight, Object hint, boolean higherQuality, int imageType)
BufferedImage.
NOTE: Adapted from code at
http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.htmlimg - 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)BufferedImageCopyright © 2007-2012. All Rights Reserved.