Routines (alphabetical) > Routines: R > READ_XWD

# READ_XWD

The READ_XWD function reads the contents of a file created by the `xwd` (X Windows Dump) command and returns the image and color table vectors in the form of IDL variables.

Note: This function is intended to be used only on files containing 8-bit pixmaps created with `xwd` version 6 or later.

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

## Examples

To open and read the X Windows Dump file named `my.xwd` in the current directory, store the image in the variable `image1`, and store the color vectors in the variables, `R`, `G`, and `B`, enter:

image1 = READ_XWD('my.xwd', R, G, B)

To load the new color table and display the image, enter:

TVLCT, R, G, B

TV, image1

## Syntax

Result = READ_XWD( Filename[, R, G, B] )

## Return Value

READ_XWD returns a 2-D byte array containing the image. If the file cannot be open or read, the return value is zero.

## Arguments

### Filename

A scalar string specifying the full pathname of the XWD file to read.

### R, G, B

Named variables that will contain the Red, Green, and Blue color vectors, if the XWD file contains color tables.

## Keywords

None

## Version History

Pre-4.0 | Introduced

## See Also

READ_X11_BITMAP