Class PngDecoder


  • public class PngDecoder
    extends com.idrsolutions.image.JDeliImage
    Class reads PNG images as BufferedImage // Make NO assumptions about type of BufferedImage type returned (may change)

    Example 1 (Using raw byte data):

    
     PngDecoder decoder = new PngDecoder();
     BufferedImage decodedImage = decoder.read(pngByteData);
     

    Example 2 (Using File):

    
     File pngFile = new File("C:\\path\\to\\output\\file.png");
     PngDecoder decoder = new PngDecoder();
     BufferedImage decodedImage = decoder.read(pngFile);
     
    • Constructor Detail

      • PngDecoder

        public PngDecoder()
    • Method Detail

      • read

        public BufferedImage read​(byte[] pngRawData)
                           throws Exception
        Decodes and returns the PNG image as a BufferedImage from bytes
        Parameters:
        pngRawData - byte[] containing the PNG data to be decoded
        Returns:
        BufferedImage The decoded image
        Throws:
        Exception
      • read

        public BufferedImage read​(File file)
                           throws Exception
        Decodes and returns the PNG image as a BufferedImage from a File
        Parameters:
        file - input image file to be decoded
        Returns:
        BufferedImage decoded image
        Throws:
        Exception