GIF (Graphics Interchange Format)

GIF is a widely supported format for raster graphics, defined by Compuserve, Inc. The program xv (by John Bradley, can be used to display GIF files on UNIX and VMS workstations. PGPLOT uses the GIF87a variant, with up to 8 bits per pixel (256 colors).

The GIF specification incorporates the Lempel-Zev-Welch (LZW) compression algorithm which is the subject of a patent awarded to Unisys. Use of this technology, and in particular creation of GIF format files using this PGPLOT device driver, may require a license from Unisys.

Device type code
/GIF (landscape orientation), /VGIF (portrait orientation).
Default file name
A GIF file can contain only a single image, so for multi-page plots PGPLOT creates additional files. If the supplied file name contains the character #, the file name is derived by replacing this character with the current page number. If the supplied file name does not contain a #, PGPLOT appends an underscore and the page number for the second and subsequent pages, e.g.,
   PGBEG file name:	File names used:
    pgplot#.gif          pgplot1.gif, pgplot2.gif, pgplot3.gif, ...
    pgplot.gif           pgplot.gif, pgplot.gif_2, pgplot.gif_3, ...
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
/GIF: 850 by 680 pixels (nominally 10.0 by 8.0 inches)
/VGIF: 680 by 850 pixels (nominally 8.0 by 10.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.
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
Environment variables
PGPLOT_GIF_WIDTH : width of image in pixels (default 850)
PGPLOT_GIF_HEIGHT : height of image in pixels (default 680)
File format
GIF files are binary files.
Remko Scharroo, Tim Pearson, 1994.

Transparent Background Images

The GIF87a images produced by PGPLOT do not have a way of specifying a transparent background. You can mark the background as transparent if you convert the file to GIF89a format using giftrans and specify that color index 0 should be transparent.

To use giftrans, just type
giftrans -t index GIF87a-file > GIF89a-file
This converts the GIF87a-file to a GIF89a-file, with the index entry in the colormap made transparent. Invoke giftrans with the -? option to see a complete usage description.