Class PngDecoder

  • All Implemented Interfaces:
    com.idrsolutions.image.Decoder

    public class PngDecoder
    extends com.idrsolutions.image.JDeliImage
    implements com.idrsolutions.image.Decoder
    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 Summary

      Constructors 
      Constructor Description
      PngDecoder()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.awt.image.BufferedImage read​(byte[] pngRawData)
      Decodes and returns the PNG image as a BufferedImage from bytes
      java.awt.image.BufferedImage read​(java.io.File file)
      Decodes and returns the PNG image as a BufferedImage from a File
      • 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, readImageAt, setMetadata
    • Constructor Detail

      • PngDecoder

        public PngDecoder()
    • Method Detail

      • read

        public java.awt.image.BufferedImage read​(byte[] pngRawData)
                                          throws java.lang.Exception
        Decodes and returns the PNG image as a BufferedImage from bytes
        Specified by:
        read in interface com.idrsolutions.image.Decoder
        Parameters:
        pngRawData - byte[] containing the PNG data to be decoded
        Returns:
        BufferedImage The decoded image
        Throws:
        java.lang.Exception
      • read

        public java.awt.image.BufferedImage read​(java.io.File file)
                                          throws java.lang.Exception
        Decodes and returns the PNG image as a BufferedImage from a File
        Specified by:
        read in interface com.idrsolutions.image.Decoder
        Parameters:
        file - input image file to be decoded
        Returns:
        BufferedImage decoded image
        Throws:
        java.lang.Exception