Class JPEGLosslessDecoderWrapper

java.lang.Object
com.twelvemonkeys.imageio.plugins.jpeg.JPEGLosslessDecoderWrapper

final class JPEGLosslessDecoderWrapper extends 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

  • Field Details

  • Constructor Details

    • JPEGLosslessDecoderWrapper

      JPEGLosslessDecoderWrapper(JPEGImageReader listenerDelegate)
  • Method Details

    • readImage

      BufferedImage readImage(List<Segment> segments, ImageInputStream input) throws 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:
      IOException - is thrown if the decoder failed or a conversion is not supported
    • readRaster

      Raster readRaster(List<Segment> segments, ImageInputStream input) throws IOException
      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 buffer
      precision -
      width - of the image
      height - of the image @return a BufferedImage.TYPE_USHORT_GRAY
    • to8Bit1ComponentGrayScale

      private 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 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