The WRITE_PICT procedure writes an image and its color table vectors to a PICT (version 2) format image file. The PICT format is used by Mac computers.

Note: WRITE_PICT creates 8-bit images.

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

Examples


Create a pseudo screen dump from the current window. Note that this works only on a PseudoColor (8-bit) display:

WRITE_PICT, 'test.pict', TVRD()
 

The following lines create an image in an IDL graphics window, read it from the window and write it as a .pict file in the temporary directory, then read the .pict file and display it in the same graphics window:

; Save device settings and tell IDL to use a color table
DEVICE, GET_DECOMPOSED=old_decomposed
DEVICE, DECOMPOSED=0
LOADCT, 14
; Create an image and display it
IMAGE1 = DIST(300)
WINDOW, 1, XSIZE=300, YSIZE=300
TV, IMAGE1
; Write a bitmap file to the temporary directory
filename = FILEPATH('test.pict', /TMP)
WRITE_PICT, filename, TVRD()
PRINT, 'File written to ', filename
; Read in the file
READ_PICT, filename, IMAGE2
; Display the IMAGE1 and IMAGE2 side by side
WINDOW, 1, XSIZE=600, YSIZE=300, $
TITLE='Original (left) and Image read from file (right)'
TV, IMAGE1, 0
TV, IMAGE2, 1
; Restore device settings.
DEVICE, DECOMPOSED=old_decomposed

Note that the restored image may be of poor quality if you are using a TrueColor display, since WRITE_PICT and READ_PICT have no facility for writing or reading TrueColor images.

Syntax


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

Arguments


Filename

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

Image

The byte array to be written to the PICT file. If Image is omitted, the entire current graphics window is read into an array and written to the PICT file.

R, G, B

The Red, Green, and Blue color vectors to be written to the PICT file. If R, G, B values are not provided, the last color table established using LOADCT is included. If no color table has been established, WRITE_PICT calls LOADCT to load the grayscale entry (table 0).

Version History


Pre-4.0

Introduced

See Also


READ_PICT, QUERY_* Routines