public class ImageUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FORMAT_BMP
Bitmap image format.
|
static java.lang.String |
FORMAT_GIF
Graphics Interchange Format.
|
static java.lang.String |
FORMAT_JPG
Joint Photographic Experts Group format.
|
static java.lang.String |
FORMAT_PNG
Portable Network Graphic format.
|
static java.lang.String |
FORMAT_WBMP
Wireless Application Protocol Bitmap image format.
|
Constructor and Description |
---|
ImageUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
clamp(int c)
Clamp a value to the range 0..255
|
static java.awt.image.BufferedImage |
createEmptyImage(java.awt.image.BufferedImage source) |
static byte[] |
imageToBytes(java.awt.image.BufferedImage bi)
Return image raster as bytes array.
|
static java.awt.image.BufferedImage |
readFromResource(java.lang.String resource) |
static byte[] |
toByteArray(java.awt.image.BufferedImage image,
java.lang.String format)
Convert
BufferedImage to byte array. |
public static final java.lang.String FORMAT_GIF
public static final java.lang.String FORMAT_PNG
public static final java.lang.String FORMAT_JPG
public static final java.lang.String FORMAT_BMP
public static final java.lang.String FORMAT_WBMP
public static byte[] toByteArray(java.awt.image.BufferedImage image, java.lang.String format)
BufferedImage
to byte array.image
- the image to be convertedformat
- the output image formatpublic static java.awt.image.BufferedImage readFromResource(java.lang.String resource)
public static java.awt.image.BufferedImage createEmptyImage(java.awt.image.BufferedImage source)
public static int clamp(int c)
public static byte[] imageToBytes(java.awt.image.BufferedImage bi)
bi
- the BufferedImage
Copyright © 2012-2018 Bartosz Firyn (SarXos). All Rights Reserved.