java.lang.Object
org.seppiko.commons.utils.image.ImageUtil
Image utility
- Author:
- Leonard Woo
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]compressor(BufferedImage image, String formatName, float quality, boolean enableProgressiveMode) 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, boolean enableProgressiveMode) throws IOException, NullPointerException, IllegalArgumentException Compress image.- Parameters:
image- aBufferedImageinstance.formatName- aStringcontaining the informal name of a format. (e.g., "jpeg" or "tiff").quality- afloatbetween0and1indicating the desired quality level.enableProgressiveMode- if true enable progressive mode.- Returns:
- the image byte array.
- Throws:
IOException- I/O Error.NullPointerException- Image isnull.IllegalArgumentException- format name isnull. Or- See Also:
-
writeImage
public static byte[] writeImage(BufferedImage image, String formatName) throws IOException, NullPointerException Write image to byte array.- Parameters:
image- aBufferedImageinstance.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.
-