Skip to content

PNG plugin

n-lagomarsini edited this page Feb 28, 2014 · 1 revision

PNG plugin

The PNG project aims to provide a new writer for PNG images. This writer internally uses PNGJ a new open source, pure JAVA encoder for PNG images. This PNG encoder provides better performances if compared to those of the Native ImageIO.

Note that this PNG writer cannot be called with the associated ImageWriterSpi object, but it must be instantiated directly.

PNGWriter

Let us put together some information about how the PNGWriter works.

The writing operation is executed with the following steps:

  • the user must check if the input image belongs to one of the supported images by calling the method isScanlineSupported();
  • if the image is supported, then the user can skip to the next step. Else the user must process the input image by rescaling it to a byte image.
  • the user must pass to the writer the input image, the compression quality, the outputStream(which needs to be an instance of OutputStream) to write and a FilterType object. This last object is defined inside the PNGJ library and is used for modifying the behaviour of the inner PNG encoder.
  • the compression level and the filter type are automatically passed to the inner encoder.
  • the writer internally checks if the image has a color table or and alpha channel.
  • the encoder starts to encode the image by writing a row at time.
  • finally the encoder returns the input image.
Clone this wiki locally