Class JPEGLosslessDecoderWrapper
java.lang.Object
com.twelvemonkeys.imageio.plugins.jpeg.JPEGLosslessDecoderWrapper
This class provides the conversion of input data
containing a JPEG Lossless to an BufferedImage.
Take care, that only the following lossless formats are supported: 1.2.840.10008.1.2.4.57 JPEG Lossless, Nonhierarchical (Processes 14) 1.2.840.10008.1.2.4.70 JPEG Lossless, Nonhierarchical (Processes 14 [Selection 1])
Currently the following conversions are supported - 24Bit, RGB -> BufferedImage.TYPE_INT_RGB - 8Bit, Grayscale -> BufferedImage.TYPE_BYTE_GRAY - 16Bit, Grayscale -> BufferedImage.TYPE_USHORT_GRAY
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) BufferedImagereadImage(List<Segment> segments, ImageInputStream input) Decodes a JPEG Lossless stream to aBufferedImage.(package private) RasterreadRaster(List<Segment> segments, ImageInputStream input) private BufferedImageto16Bit1ComponentGrayScale(int[][] decoded, int precision, int width, int height) Converts the decoded buffer into a BufferedImage.private BufferedImageto24Bit3ComponentRGB(int[][] decoded, int width, int height) Converts the decoded buffer into a BufferedImage.private BufferedImageto8Bit1ComponentGrayScale(int[][] decoded, int width, int height) Converts the decoded buffer into a BufferedImage.
-
Field Details
-
listenerDelegate
-
-
Constructor Details
-
JPEGLosslessDecoderWrapper
JPEGLosslessDecoderWrapper(JPEGImageReader listenerDelegate)
-
-
Method Details
-
readImage
Decodes a JPEG Lossless stream to aBufferedImage. Currently the following conversions are supported: - 24Bit, RGB -> BufferedImage.TYPE_3BYTE_BGR - 8Bit, Grayscale -> BufferedImage.TYPE_BYTE_GRAY - 16Bit, Grayscale -> BufferedImage.TYPE_USHORT_GRAY- Parameters:
segments- segmentsinput- input stream which contains JPEG Lossless data- Returns:
- if successfully a BufferedImage is returned
- Throws:
IOException- is thrown if the decoder failed or a conversion is not supported
-
readRaster
- Throws:
IOException
-
to16Bit1ComponentGrayScale
private BufferedImage to16Bit1ComponentGrayScale(int[][] decoded, int precision, int width, int height) Converts the decoded buffer into a BufferedImage. precision: 16 bit, componentCount = 1- Parameters:
decoded- data bufferprecision-width- of the imageheight- of the image @return a BufferedImage.TYPE_USHORT_GRAY
-
to8Bit1ComponentGrayScale
Converts the decoded buffer into a BufferedImage. precision: 8 bit, componentCount = 1- Parameters:
decoded- data bufferwidth- of the imageheight- of the image- Returns:
- a BufferedImage.TYPE_BYTE_GRAY
-
to24Bit3ComponentRGB
Converts the decoded buffer into a BufferedImage. precision: 8 bit, componentCount = 3- Parameters:
decoded- data bufferwidth- of the imageheight- of the image- Returns:
- a BufferedImage.TYPE_3BYTE_RGB
-