Class JpegXLDecoder

java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.jpegxl.JpegXLDecoder
All Implemented Interfaces:
com.idrsolutions.image.Decoder

public class JpegXLDecoder extends com.idrsolutions.image.JDeliImage implements com.idrsolutions.image.Decoder
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Output samples are sRGB gray, one byte per pixel
    static final int
    Output samples are sRGB, three bytes per pixel in RGB order

    Fields inherited from class com.idrsolutions.image.JDeliImage

    bb
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the colour space of the samples returned by the last call to readComponentsAsBytes(byte[]), CS_GRAYSCALE or CS_SRGB, or -1 if not yet called.
    boolean
    isReadable(byte[] data)
    Checks whether the jpeg xl image data can be decoded, by validating its structure without decoding the pixels
    boolean
    isReadable(File imageFile)
    Checks whether the jpeg xl image file can be decoded, by validating its structure without decoding the pixels
    read(byte[] jpegxlRawData)
    Make NO assumptions about BufferedImage type returned as it may change
    read(File file)
    Make NO assumptions about BufferedImage type returned as it may change
    byte[]
    readComponentsAsBytes(byte[] jpegxlRawData)
    Decodes the JPEG XL image to interleaved 8 bit samples converted to sRGB, without creating a BufferedImage.
    readDimension(byte[] data)
     
    readDimension(File imageFile)
     

    Methods inherited from class com.idrsolutions.image.JDeliImage

    optimiseImage

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.idrsolutions.image.Decoder

    getImageCount, getImageCount, readEmbeddedThumbnail, readEmbeddedThumbnail, readImageAt, readImageAt, readImageSpecificMetaData, readImageSpecificMetaData, setMetadata
  • Field Details

    • CS_GRAYSCALE

      public static final int CS_GRAYSCALE
      Output samples are sRGB gray, one byte per pixel
      See Also:
    • CS_SRGB

      public static final int CS_SRGB
      Output samples are sRGB, three bytes per pixel in RGB order
      See Also:
  • Constructor Details

    • JpegXLDecoder

      public JpegXLDecoder()
  • Method Details

    • readComponentsAsBytes

      public byte[] readComponentsAsBytes(byte[] jpegxlRawData) throws Exception
      Decodes the JPEG XL image to interleaved 8 bit samples converted to sRGB, without creating a BufferedImage. Gray images have one byte per pixel and colour images three bytes per pixel in RGB order, use getColorSpace() afterwards to find out which.
      Parameters:
      jpegxlRawData - byte[] containing the JPEG XL data to be decoded
      Returns:
      byte[] of the decoded samples
      Throws:
      Exception - if an error occurs in reading image
    • getColorSpace

      public int getColorSpace()
      Returns the colour space of the samples returned by the last call to readComponentsAsBytes(byte[]), CS_GRAYSCALE or CS_SRGB, or -1 if not yet called.
      Returns:
      the colour space of the samples returned by the last call to readComponentsAsBytes(byte[]), CS_GRAYSCALE or CS_SRGB, or -1 if not yet called
    • read

      public BufferedImage read(byte[] jpegxlRawData) throws Exception
      Make NO assumptions about BufferedImage type returned as it may change

      Decodes and returns the JPEG XL image as a BufferedImage from bytes

      Specified by:
      read in interface com.idrsolutions.image.Decoder
      Parameters:
      jpegxlRawData - byte[] containing the JPEG XL data to be decoded
      Returns:
      BufferedImage The decoded image
      Throws:
      Exception - if an error occurs in reading image
    • read

      public BufferedImage read(File file) throws Exception
      Make NO assumptions about BufferedImage type returned as it may change

      Decodes and returns the JPEG XL image as a BufferedImage

      Specified by:
      read in interface com.idrsolutions.image.Decoder
      Parameters:
      file - file containing the JPEG XL data to be decoded
      Returns:
      BufferedImage The decoded image
      Throws:
      Exception - if an error occurs in reading image
    • readDimension

      public Rectangle readDimension(byte[] data) throws Exception
      Specified by:
      readDimension in interface com.idrsolutions.image.Decoder
      Throws:
      Exception
    • isReadable

      public boolean isReadable(byte[] data) throws Exception
      Checks whether the jpeg xl image data can be decoded, by validating its structure without decoding the pixels
      Specified by:
      isReadable in interface com.idrsolutions.image.Decoder
      Parameters:
      data - jpeg xl image data
      Returns:
      true if the image can be decoded
      Throws:
      Exception - if problem reading image
    • isReadable

      public boolean isReadable(File imageFile) throws Exception
      Checks whether the jpeg xl image file can be decoded, by validating its structure without decoding the pixels
      Specified by:
      isReadable in interface com.idrsolutions.image.Decoder
      Parameters:
      imageFile - jpeg xl image file
      Returns:
      true if the image can be decoded
      Throws:
      Exception - if problem reading image
    • readDimension

      public Rectangle readDimension(File imageFile) throws Exception
      Specified by:
      readDimension in interface com.idrsolutions.image.Decoder
      Throws:
      Exception