Class JpegDecoder

java.lang.Object
com.idrsolutions.image.JDeliImage
com.idrsolutions.image.jpeg.JpegDecoder
All Implemented Interfaces:
com.idrsolutions.image.Decoder

public class JpegDecoder extends com.idrsolutions.image.JDeliImage implements com.idrsolutions.image.Decoder
Class reads JPEG image as BufferedImage // Make NO assumptions about type of BufferedImage type returned (may change) Example:

 JpegDecoder decoder = new JpegDecoder();
 BufferedImage decodedImage = decoder.read(jpegByteData);
 
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    read(byte[] jpegRawData)
    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[]
    readAsUnconvertedBytes(byte[] jpegRawData, int adobeColorTransform, com.idrsolutions.image.jpeg.data.Info info)
    Not recommended for external use.
    byte[]
    readComponentsAsRawBytes(byte[] jpegRawData)
    Not recommended for external use.
    readDimension(byte[] jpegRawData)
    Decodes and returns the width and height of jpeg image
    Decodes and returns the width and height of jpeg image
    readEmbeddedThumbnail(byte[] data)
    Decodes and returns the thumbnail heic image as BufferedImage if there is an thumbnail otherwise returns null
    Decodes and returns the thumbnail heic image as BufferedImage if there is an thumbnail otherwise returns null

    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, readImageAt, readImageAt, readImageSpecificMetaData, setMetadata
  • Field Details

    • ZIGZAGORDER

      public static final byte[] ZIGZAGORDER
  • Constructor Details

    • JpegDecoder

      public JpegDecoder()
  • Method Details

    • read

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

      Decodes and returns the JPEG image as a BufferedImage from bytes

      Specified by:
      read in interface com.idrsolutions.image.Decoder
      Parameters:
      jpegRawData - byte[] containing the JPEG 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 image as a BufferedImage from bytes

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

      public Rectangle readDimension(File file) throws Exception
      Decodes and returns the width and height of jpeg image
      Specified by:
      readDimension in interface com.idrsolutions.image.Decoder
      Parameters:
      file - image image contained in raw data if present
      Returns:
      width and height of image
      Throws:
      Exception - if problem reading image
    • readDimension

      public Rectangle readDimension(byte[] jpegRawData) throws Exception
      Decodes and returns the width and height of jpeg image
      Specified by:
      readDimension in interface com.idrsolutions.image.Decoder
      Parameters:
      jpegRawData - image image contained in raw data if present
      Returns:
      Rectangle width and height of image
      Throws:
      Exception - if problem reading image
    • readEmbeddedThumbnail

      public BufferedImage readEmbeddedThumbnail(File file) throws Exception
      Decodes and returns the thumbnail heic image as BufferedImage if there is an thumbnail otherwise returns null
      Specified by:
      readEmbeddedThumbnail in interface com.idrsolutions.image.Decoder
      Parameters:
      file - jpeg file
      Returns:
      BufferedImage thumbnail image
      Throws:
      Exception - if problem reading image
    • readEmbeddedThumbnail

      public BufferedImage readEmbeddedThumbnail(byte[] data) throws Exception
      Decodes and returns the thumbnail heic image as BufferedImage if there is an thumbnail otherwise returns null
      Specified by:
      readEmbeddedThumbnail in interface com.idrsolutions.image.Decoder
      Parameters:
      data - jpeg bytes
      Returns:
      BufferedImage thumbnail image
      Throws:
      Exception - if problem reading image
    • readComponentsAsRawBytes

      public byte[] readComponentsAsRawBytes(byte[] jpegRawData) throws Exception
      Not recommended for external use.

      Decodes JPEG image data as non converted bytes. Please note this method does not perform YCBCR/CMYK/YCCK to RGB/gray conversion.

      Parameters:
      jpegRawData - byte[] containing the raw JPEG data
      Returns:
      byte[] YCBCR converted data of the JPEG
      Throws:
      Exception - Provides for different exceptions thrown under Java Lang package
    • readAsUnconvertedBytes

      public byte[] readAsUnconvertedBytes(byte[] jpegRawData, int adobeColorTransform, com.idrsolutions.image.jpeg.data.Info info) throws Exception
      Not recommended for external use.

      Decodes JPEG image data as un-converted(RGB/gray) bytes

      Parameters:
      jpegRawData - byte[] array containing the un-converted JPEG bytes
      adobeColorTransform - colorspace as defined by Adobe spec
      info - values found in image header
      Returns:
      converted JPEG byte[]
      Throws:
      Exception - Provides for different exceptions thrown under java Lang package