PngEncoder is a Java class which takes a Java Image object (based on DirectColorModel) and returns a byte-array in PNG format. This byte-array is suitable for saving as a PNG file or delivery to a client from a servlet. The class optionally encodes alpha information from the Image. PngEncoderB takes a Java BufferedImage object (which may have either a DirectColorModel or IndexColorModel) and returns a byte array in PNG format..