Package com.saperion.util
Class SaImageConverter
- java.lang.Object
-
- com.saperion.util.SaImageConverter
-
public final class SaImageConverter extends java.lang.ObjectUtility class used to convert between various image formats.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSaImageConverter.ImageFormatImage formats available for conversion.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.image.BufferedImagebmpToBufferedImage(byte[] bmp, SaImageConverter.ImageFormat format)Converts a bitmap to a BufferedImage.static java.awt.image.BufferedImagedibToBufferedImage(byte[] dibBytes, SaImageConverter.ImageFormat format)Converts a device independent bitmat (DIB) to a BufferedImage.static java.awt.image.BufferedImagemakeTransparent(java.awt.image.BufferedImage image, java.awt.Color color)Makes the given image transparent.
-
-
-
Method Detail
-
bmpToBufferedImage
public static java.awt.image.BufferedImage bmpToBufferedImage(byte[] bmp, SaImageConverter.ImageFormat format) throws java.io.IOException, SaImageConverterExceptionConverts a bitmap to a BufferedImage.- Parameters:
bmp- bitmapformat- format for the BufferedImage- Returns:
- BufferedImage with the bitmap's content and the specified format
- Throws:
java.io.IOException- io exceptionSaImageConverterException- image conversion failed
-
dibToBufferedImage
public static java.awt.image.BufferedImage dibToBufferedImage(byte[] dibBytes, SaImageConverter.ImageFormat format) throws java.io.IOException, SaImageConverterExceptionConverts a device independent bitmat (DIB) to a BufferedImage.- Parameters:
dibBytes- dib bytesformat- format for the BufferedImage- Returns:
- BufferedImage with the dib's content and the specified format or null if the dib bytes contained only zeros
- Throws:
java.io.IOException- io exceptionSaImageConverterException- conversion failed
-
makeTransparent
public static java.awt.image.BufferedImage makeTransparent(java.awt.image.BufferedImage image, java.awt.Color color)Makes the given image transparent. Turn all pixels to transparent, which have the given color. UsesRGBImageFilterfilter to convert pixel to transparent.- Parameters:
image- the image to turn transparencycolor- the color to turn pixels transparent- Returns:
- the transparent buffered image
-
-