Class JPEGLosslessDecoderWrapper


  • final class JPEGLosslessDecoderWrapper
    extends java.lang.Object
    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

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) java.awt.image.BufferedImage readImage​(java.util.List<Segment> segments, javax.imageio.stream.ImageInputStream input)
      Decodes a JPEG Lossless stream to a BufferedImage.
      (package private) java.awt.image.Raster readRaster​(java.util.List<Segment> segments, javax.imageio.stream.ImageInputStream input)  
      private java.awt.image.BufferedImage to16Bit1ComponentGrayScale​(int[][] decoded, int precision, int width, int height)
      Converts the decoded buffer into a BufferedImage.
      private java.awt.image.BufferedImage to24Bit3ComponentRGB​(int[][] decoded, int width, int height)
      Converts the decoded buffer into a BufferedImage.
      private java.awt.image.BufferedImage to8Bit1ComponentGrayScale​(int[][] decoded, int width, int height)
      Converts the decoded buffer into a BufferedImage.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JPEGLosslessDecoderWrapper

        JPEGLosslessDecoderWrapper​(JPEGImageReader listenerDelegate)
    • Method Detail

      • readImage

        java.awt.image.BufferedImage readImage​(java.util.List<Segment> segments,
                                               javax.imageio.stream.ImageInputStream input)
                                        throws java.io.IOException
        Decodes a JPEG Lossless stream to a BufferedImage. 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 - segments
        input - input stream which contains JPEG Lossless data
        Returns:
        if successfully a BufferedImage is returned
        Throws:
        java.io.IOException - is thrown if the decoder failed or a conversion is not supported
      • readRaster

        java.awt.image.Raster readRaster​(java.util.List<Segment> segments,
                                         javax.imageio.stream.ImageInputStream input)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • to16Bit1ComponentGrayScale

        private java.awt.image.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 buffer
        precision -
        width - of the image
        height - of the image @return a BufferedImage.TYPE_USHORT_GRAY
      • to8Bit1ComponentGrayScale

        private java.awt.image.BufferedImage to8Bit1ComponentGrayScale​(int[][] decoded,
                                                                       int width,
                                                                       int height)
        Converts the decoded buffer into a BufferedImage. precision: 8 bit, componentCount = 1
        Parameters:
        decoded - data buffer
        width - of the image
        height - of the image
        Returns:
        a BufferedImage.TYPE_BYTE_GRAY
      • to24Bit3ComponentRGB

        private java.awt.image.BufferedImage to24Bit3ComponentRGB​(int[][] decoded,
                                                                  int width,
                                                                  int height)
        Converts the decoded buffer into a BufferedImage. precision: 8 bit, componentCount = 3
        Parameters:
        decoded - data buffer
        width - of the image
        height - of the image
        Returns:
        a BufferedImage.TYPE_3BYTE_RGB