STScI Logo

rastoim stsdas.sobsolete


NAME · USAGE · DESCRIPTION · PARAMETERS · EXAMPLES · BUGS · SEE_ALSO

NAME

rastoim -- Convert a rasterfile to an IRAF image.

USAGE

rastoim rasfile outimage outcmap

DESCRIPTION

Convert an eight-bit Sun rasterfile image to one or two IRAF (OIF or STF) images: a pixel image and an optional colormap image. These images may be used as input to the celco task (in the stsdas.vdisplay package) to obtain photographic hard copy. Most likely, the rasterfile format image would come from the capture of a workstation window.

Rasterfiles may be standard (RT_STANDARD) or byte-encoded (RT_BYTE_ENCODED)---either will be converted. Other rasterfile formats such as bitmaps (one bit rasterfiles) and 24 bit color rasterfiles (RGB separations) are neither recognized nor supported.

If the rasterfile contains a colormap and the outcmap parameter specifies a file name (i.e., it is not null), the colormap is written as an IRAF image. This output colormap is a two-dimensional image consisting of three lines and the number of pixels in the rasterfile colormap. The maximum range of colormap values (0:255) is scaled to the range 0:1 in the floating point output colormap image. No colormap file is created if the input rasterfile has no colormap or if the outcmap parameter is null.

The output short integer pixel image has the same dimensions as the rasterfile.

Rasterfiles have the origin (pixel 1,1) at the top left, while IRAF images have the origin at the lower left. To flip the image, use the flip parameter (the default is "yes").

Some explanatory text may be written to STDOUT if desired. The verbosity parameter specifies which information is written:


	verbosity	text
	---------	----
	    0		none
	    1		image size
	    2		image name, depth, colormap size
	    3		colormap values

Some rasterfiles have short colormaps---that is, fewer than 256 colors. In this case, the output colormap will still have 256 colors, but the excess values will be zero (black), but this doesn't matter, since these colors should not be referenced in the image.

Optionally, the color palette (map) may be converted to gray values in the output image. In this case, no output colormap image is created. The gray values are computed from the RGB by the NTSC formula:


    gray = 0.299*red + 0.587*green + 0.114*blue

This task should be fully portable. It does not depend on Sun libraries.

PARAMETERS

rasfile = "" [file name]
The input file to be converted. This is assumed to be an eight-bit Sun rasterfile. It may include a colormap but does not need one.
outimg = "" [file name]
The output IRAF image. The image will be short integer and will have the same width and height as the input rasterfile.
outcmap = "" [file name]
An IRAF image that will contain the colormap. One-byte rasterfile colormap entries will map to a data range of 0:1 in the floating point output image. Each of the three color sets constitute a line in the two-dimensional output image. If this parameter is null, no colormap file is written.
(flip = yes) [boolean]
Reverse the order of the lines in the image?

This is useful for flipping the image vertically since the origin of the rasterfiles is at the top left and the origin of the IRAF images is at the bottom left.

(gray = no) [boolean]
Convert the RGB color palette to gray?

This overrides colormap output. If gray=yes and outcmap is not null, then a warning message is issued and no output colormap is created.

(verbosity = 0) [integer, min=0, max=3]
The level of output written to STDOUT. The following output is produced for each possible value:

	verbosity	text
	---------	----
	    0		none
	    1		image size
	    2		image name, depth, colormap size
	    3		colormap values

EXAMPLES

1. Convert the rasterfile sun.ras to an IRAF image sun.imh and colormap file sun_cmap.imh:

  pl> rastoim sun.ras sun.imh sun_cmap.imh

BUGS

Does not handle all rasterfile types, particularly bitmaps and 24-bit color images.

SEE ALSO

imtool


Source Code · Package Help · Search Form · STSDAS