The WRITE_SRF procedure writes an image and its color table vectors to a Sun Raster File (SRF).
WRITE_SRF only writes 32-, 24-, and 8-bit-deep rasterfiles of type RT_STANDARD. Use the UNIX command rasfilter8to1 to convert these files to 1-bit deep files. See the file /usr/include/rasterfile.h for the structure of Sun rasterfiles.
This routine is written in the IDL language. Its source code can be found in the file write_srf.pro in the lib subdirectory of the IDL distribution.
The following lines create an image in an IDL graphics window, read it from the window and write it as a .srf file in the temporary directory, then read the .srf file and display it in the same graphics window:
IMAGE1 = DIST(300)
WINDOW, 1, XSIZE=300, YSIZE=300
filename = FILEPATH('test.srf', /TMP)
WRITE_SRF, filename, TVRD(/TRUE)
PRINT, 'File written to ', filename
READ_SRF, filename, IMAGE2
WINDOW, 1, XSIZE=600, YSIZE=300, $
TITLE='Original (left) and Image read from file (right)'
TV, IMAGE1, 0
TV, IMAGE2, 1, /TRUE
WRITE_SRF, Filename [, Image, R, G, B] [, /ORDER] [, /WRITE_32]
A scalar string containing the full pathname of the SRF to write.
The array to be written to the SRF. If Image has dimensions (3,n,m), a 24-bit SRF is written. If Image is omitted, the entire current graphics window is read into an array and written to the SRF file. Image should be of byte type, and in top to bottom scan line order.
R, G, B
The Red, Green, and Blue color vectors to be written to the 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_SRF calls LOADCT to load the grayscale entry (table 0).
Set this keyword to write the image from the top down instead of from the bottom up. This setting is only necessary when writing a file from the current IDL graphics window; it is ignored when writing a file from a data array passed as a parameter.
Set this keyword to write a 32-bit file. If the input image is a TrueColor image, dimensioned (3, n, m), it is normally written as a 24-bit raster file.
READ_SRF, QUERY_* Routines