The WRITE_GIF procedure writes an image and its color table vectors to a Graphics Interchange Format ( GIF) file.

WRITE_GIF produces 8-bit GIF files of the standard type: non-interlaced, global colormap.

This routine is written in the IDL language. Its source code can be found in the file write_gif.pro in the lib subdirectory of the IDL distribution.

Calling Sequence

WRITE_GIF, Filename, Image[, R, G, B]



A scalar string containing the full pathname of the GIF file to write.


The array to write into the new GIF file.

R, G, B

The Red, Green, and Blue color vectors to be written with to the GIF file. If R , G , B values are not provided, the last color table established using LOADCT is saved, and the table is padded to 256 entries. If no color table has been established, WRITE_GIF calls LOADCT to load the grayscale entry (table 0).



Set this keyword to close any open files. The CLOSE keyword is only useful if a file containing multiple images (as specified by the MULTIPLE keyword) is being written. If the CLOSE keyword is specified, nothing is written to the file, and all other parameters are ignored.


Set this keyword to write multiple images to a file. Each call to WRITE_GIF writes the next image, with the file remaining open between calls. The Filename argument is ignored after the first call, but must be supplied . After the first image has been written, any R, G, and B color vectors supplied are ignored. All images written to a GIF file must be the same size.


The following command captures the contents of the current IDL graphics window and saves it to a GIF file named test.gif :

WRITE_GIF, 'test.gif', TVRD()

See Also