Class 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 Detail

      • ZIGZAGORDER

        public static final byte[] ZIGZAGORDER
    • Constructor Detail

      • JpegDecoder

        public JpegDecoder()
    • Method Detail

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

        Parameters:
        file - file containing the JPEG data to be decoded
        Returns:
        BufferedImage The decoded image
        Throws:
        Exception
      • 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)
                                      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 -
        Returns:
        converted JPEG byte[]
        Throws:
        Exception - Provides for different exceptions thrown under java Lang package
      • setInverted

        public void setInverted​(boolean inverted)
        Not recommended for external use. Inverts CMYK
        Parameters:
        inverted - set true for CMYK inversion
      • getInfo

        public com.idrsolutions.image.jpeg.data.Info getInfo()
        Returns the JPEG information object
        Returns:
        JPEG information object