| java.lang.Object net.jforum.util.image.ImageUtils
ImageUtils | public class ImageUtils (Code) | | Utilities methods for image manipulation. It does not support writting of GIF images, but it can
read from. GIF images will be saved as PNG.
author: Rafael Steil version: $Id: ImageUtils.java,v 1.23 2007/09/09 01:05:22 rafaelsteil Exp $ |
Method Summary | |
public static BufferedImage | createHeadlessBufferedImage(BufferedImage image, int type, int width, int height) Creates a BufferedImage from an Image . | public static BufferedImage | createHeadlessSmoothBufferedImage(BufferedImage source, int type, int width, int height) Creates a BufferedImage from an Image . | public static boolean | hasAlpha(Image image) Determines if the image has transparent pixels. | public static BufferedImage | resizeImage(String imgName, int type, int maxWidth, int maxHeight) Resizes an image
Parameters: imgName - The image name to resize. | public static BufferedImage | resizeImage(BufferedImage image, int type, int maxWidth, int maxHeight) Resizes an image. | public static void | saveCompressedImage(BufferedImage image, String toFileName, int type) Compress and save an image to the disk. | public static boolean | saveImage(BufferedImage image, String toFileName, int type) Saves an image to the disk.
Parameters: image - The image to save Parameters: toFileName - The filename to use Parameters: type - The image type. |
IMAGE_GIF | final public static int IMAGE_GIF(Code) | | |
IMAGE_JPEG | final public static int IMAGE_JPEG(Code) | | |
IMAGE_PNG | final public static int IMAGE_PNG(Code) | | |
IMAGE_UNKNOWN | final public static int IMAGE_UNKNOWN(Code) | | |
createHeadlessBufferedImage | public static BufferedImage createHeadlessBufferedImage(BufferedImage image, int type, int width, int height)(Code) | | Creates a BufferedImage from an Image . This method can
function on a completely headless system. This especially includes Linux and Unix systems
that do not have the X11 libraries installed, which are required for the AWT subsystem to
operate. This method uses nearest neighbor approximation, so it's quite fast. Unfortunately,
the result is nowhere near as nice looking as the createHeadlessSmoothBufferedImage method.
Parameters: image - The image to convert Parameters: w - The desired image width Parameters: h - The desired image height The converted image Parameters: type - int |
createHeadlessSmoothBufferedImage | public static BufferedImage createHeadlessSmoothBufferedImage(BufferedImage source, int type, int width, int height)(Code) | | Creates a BufferedImage from an Image . This method can
function on a completely headless system. This especially includes Linux and Unix systems
that do not have the X11 libraries installed, which are required for the AWT subsystem to
operate. The resulting image will be smoothly scaled using bilinear filtering.
Parameters: source - The image to convert Parameters: w - The desired image width Parameters: h - The desired image height The converted image Parameters: type - int |
hasAlpha | public static boolean hasAlpha(Image image)(Code) | | Determines if the image has transparent pixels.
Parameters: image - The image to check for transparent pixel.s true of false , according to the result |
resizeImage | public static BufferedImage resizeImage(String imgName, int type, int maxWidth, int maxHeight)(Code) | | Resizes an image
Parameters: imgName - The image name to resize. Must be the complet path to the file Parameters: type - int Parameters: maxWidth - The image's max width Parameters: maxHeight - The image's max height A resized BufferedImage |
resizeImage | public static BufferedImage resizeImage(BufferedImage image, int type, int maxWidth, int maxHeight)(Code) | | Resizes an image.
Parameters: image - The image to resize Parameters: maxWidth - The image's max width Parameters: maxHeight - The image's max height A resized BufferedImage Parameters: type - int |
saveCompressedImage | public static void saveCompressedImage(BufferedImage image, String toFileName, int type)(Code) | | Compress and save an image to the disk. Currently this method only supports JPEG images.
Parameters: image - The image to save Parameters: toFileName - The filename to use Parameters: type - The image type. Use ImageUtils.IMAGE_JPEG to save as JPEG images,or ImageUtils.IMAGE_PNG to save as PNG. |
saveImage | public static boolean saveImage(BufferedImage image, String toFileName, int type)(Code) | | Saves an image to the disk.
Parameters: image - The image to save Parameters: toFileName - The filename to use Parameters: type - The image type. Use ImageUtils.IMAGE_JPEG to save as JPEG images,or ImageUtils.IMAGE_PNG to save as PNG. false if no appropriate writer is found |
|
|