You are here:  PGPLOT > Documentation > Device Manual > PNG file format

PGPLOT: PNG file format

PNG (Portable Network Graphics) is a widely supported format for raster graphics. For full information, see the PNG web page. PGPLOT can create PNG files with up to 8 bits per pixel (256 colors), with either an opaque or a transparent background.

In order to compile the PGPLOT PNG driver, and to run programs that include this driver, you need libpng, zlib, and supporting header files, which are available through the PNG web page.

Device type code
/PNG
/TPNG (transparent background)

Default file name
pgplot.png
For multi-page plots PGPLOT creates additional files. PGPLOT appends an underscore and the page number to the file name for the second and subsequent pages. If the supplied file name is ``-'', the output is sent to the standard output stream, so that it can, for example, be piped into a viewing program. This will only work for single-page plots.

Default view surface dimensions
850 by 680 pixels (nominally 10.0 by 8.0 inches)
These defaults can be overridden by specifying environment variables, or by calling routine PGPAP. The maximum size is limited only by available memory.

Resolution
PGPLOT assumes that the device resolution is 85 pixels/inch, but the actual resolution will vary depending on the display device.

Color capability
Color indices 0-255 are accepted, with standard defaults for color indices 0-15. If the color representation of a color index is changed, it affects all pixels drawn in that color on the current page.

Input capability
None.

Environment variables
PGPLOT_PNG_WIDTH : width of image in pixels (default 850)
PGPLOT_PNG_HEIGHT : height of image in pixels (default 680)

File format
PNG files are binary files.

Author
Pete Ratzlaff, pratzlaff@cfa.harvard.edu (March 1999).

Tim Pearson, California Institute of Technology, tjp·astro.caltech.edu
Copyright © 1995-2005 California Institute of Technology