The WRITE_IMAGE procedure writes an image and its color table vectors, if any, to a file of a specified type. WRITE_IMAGE can write most types of image files supported by IDL.

Syntax


WRITE_IMAGE, Filename, Format, Data [, Red, Green, Blue] [, /APPEND]

Arguments


Filename

A scalar string containing the name of the file to write.

Format

A scalar string containing the name of the file format to write. The following are the supported formats:

  • BMP
  • GIF
  • JPEG
  • PNG
  • PPM
  • SRF
  • TIFF

Data

An IDL variable containing the image data to write to the file.

Note: If the output format is "TIFF", and the Data argument is not type byte, then the TIFF file will be automatically written using that data type. For example if Data is IDL type integer, then the TIFF file will be written as signed 16-bit pixels. To force the data to be written as bytes, use the BYTSCL function on your data before calling WRITE_IMAGE.

Red

An optional vector containing the red channel of the color table if a colortable exists.

Green

An optional vector containing the green channel of the color table if a colortable exists.

Blue

An optional vector containing the blue channel of the color table if a colortable exists.

Keywords


APPEND

Set this keyword to force the image to be appended to the file instead of overwriting the file. APPEND may be used with image formats that supports multiple images per file and is ignored for formats that support only a single image per file.

Version History


5.3

Introduced

8.2.2 Change TIFF behavior to write out the data using the appropriate data type.