The READ_GIF procedure reads the contents of a GIF format image file and returns the image and color table vectors (if present) in the form of IDL variables. Only 8-bit images are supported.
This routine is written in the IDL language. Its source code can be found in the file read_gif.pro in the lib subdirectory of the IDL distribution.
Note: To find information about a potential GIF file before trying to read its data, use the QUERY_GIF function.
To open and read the GIF image file named foo.gif in the current directory, store the image in the variable image1.
READ_GIF, 'foo.gif', image1, R, G, B
TVLCT, R, G, B
READ_GIF, Filename, Image [, R, G, B] [, BACKGROUND_COLOR=variable] [, /CLOSE] [, DELAY_TIME=variable] [, DISPOSAL_METHOD=variable] [, /MULTIPLE] [, REPEAT_COUNT=variable] [, TRANSPARENT=value] [, USER_INPUT=variable]
A scalar string specifying the full path name of the image file to read.
A named variable that will contain the image data read from the file.
R, G, B
Named variables that will contain the Red, Green, and Blue color vectors, if the rasterfile contains colormaps. For GIF files with multiple images, when reading the second and subsequent images, R, G, and B are not returned unless there is a local color table for that image.
Set this keyword to a named variable that will contain the index of the background color within the global color table.
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 in use. Note that you do not need to specify the normal arguments to READ_GIF (Filename, Image, etc.) when using this keyword.
Set this keyword to a named variable that will contain the delay in hundredths (1/100) of a second that the decoder should wait after displaying the current image. If the delay time is not defined in the file, a value of 0 will be returned. There can be a different value for each image within the file.
Set this keyword to a named variable that will contain the disposal method that the decoder should use after displaying the current image. Possible values are:
No disposal specified. The decoder is not required to take any action.
Do not dispose. The graphic is to be left in place.
Restore to background color. The area used by the graphic must be restored to the background color.
Restore to previous. The decoder is required to restore the area overwritten by the graphic with what was there prior to rendering the graphic.
There can be a different value for each image within the file.
Set this keyword to read files that contain multiple images. Each call to READ_GIF returns the next image, with the file remaining open between calls. The Filename argument is ignored and may be omitted after the first call. Reading past the last image returns a scalar value of -1 in the variable specified in the Image argument, and closes the file.
Set this keyword to a named variable that will contain the repeat count for the animation within the file. A repeat count of zero indicates an infinite repeat. If the repeat count is not defined within the file then a value of -1 is returned.
Set this keyword to a named variable that will contain a byte value giving the index within the color table to be designated as the transparent color. If there is no transparency, then a value of -1 is returned. There can be a different value for each image within the file.
Set this keyword to a named variable that will contain the user input flag for the current image. A value of 0 indicates that no user input should be required, while a value of 1 indicates that the application should wait before continuing processing. The nature of the user input is determined by the application (carriage return, mouse button click, etc.). When both DELAY_TIME and USER_INPUT are present, the decoder should continue processing when user input is received or when the delay time expires, whichever occurs first. For multiple images there may be a different value for each image within the file.
Added BACKGROUND_COLOR, DELAY_TIME, DISPOSAL_METHOD, REPEAT_COUNT, TRANSPARENT, and USER_INPUT keywords
IOPEN, WRITE_GIF, QUERY_GIF