java.lang.Object
org.seppiko.commons.utils.image.ImageUtil
Image Util
- Author:
- Leonard Woo
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]compressor(BufferedImage image, String formatName, float quality) Compress image.static byte[]writeImage(BufferedImage image, String formatName) Write image to byte array.
-
Method Details
-
compressor
public static byte[] compressor(BufferedImage image, String formatName, float quality) throws IOException, NullPointerException, IllegalArgumentException Compress image.- Parameters:
image- aBufferedImage.formatName- aStringcontaining the informal name of a format.quality- afloatbetween0and1indicating the desired quality level.- Returns:
- the image byte array.
- Throws:
IOException- I/O Error.NullPointerException- Image isnull.IllegalArgumentException- format name isnull.- See Also:
-
writeImage
public static byte[] writeImage(BufferedImage image, String formatName) throws IOException, NullPointerException Write image to byte array.- Parameters:
image- aBufferedImage.formatName- aStringcontaining the informal name of a format.- Returns:
- the image byte array.
nullif no appropriate writer is found. - Throws:
IOException- I/O Error.NullPointerException- Image isnull.
-