viff2rast(1)

PROGRAM
viff2rast - Converts a VIFF image file to a Sun Raster image file.

SYNTAX

viff2rast

-i  input VIFF image file

-o  resulting output image (raster file)

[-p]
    if yes, invert image (photonegative); if no (default) do not invert image (photopositive)

[-V]
    Gives the version for viff2rast

[-U]
    Gives the usage for viff2rast

[-P]
    Prompts for command line options

[-A [file1]]
    Creates the answer file called viff2rast.ans or file1

[-a [file1]]
    Uses viff2rast.ans or file1 as the answer file

DESCRIPTION
viff2rast is a routine to convert a khoros VIFF image to a SUN raster image.

This routine will convert a BYTE (8 bit) or BIT (1 bit) VIFF image to a SUN raster image. Valid VIFF images are:

1.  Must be of type BYTE or BIT

2.  If the image is of type BYTE, then it can have either one data band or three data bands.

3.  Image with one data band: This image is vaild with a colormap of the BYTE or without a colormap. If the colormap exists it must be of type BYTE and must contain either 1 or 3 columns. If the colormap only contains one column, that column will be repicated three times when put in the SUN raster image, otherwise the colormap has 3 columns red, green and blue. If the image does not contain a colormap the rast image image will not contain a colormap.

4.  Image with three data bands: This is considered an RGB image or a 24 bit image. The color_space_model must be set to generic_RGB or NTSC_RGB.

The -p option is only valid if the input VIFF image is of type BIT. Since different machines intreprete black and white values differently, one may want to "flip" the bit values to produce a desirable image.

The resulting SUN rast image will be stored in IEEE or Big Endian byte order. The following is a listing of the SUN rast header used by this routine:

    A Sun raster image file is composed of three parts: a header containing 8 integers, a possibly empty set of colormap values, and the pixel image, stored a line at a time, in increasing y order. The image is layed out in the file as in a memory pixrect. Each line of the image is rounded up to the nearest 16 bits.

    The header is defined as follows:
                            int  ras_magic;
                            int  ras_width;
                            int  ras_height;
                            int  ras_depth;
                            int  ras_length;
                            int  ras_type;
                            int  ras_maptype;
    The ras_magic field always contains the value 0x59a66a95 (hex).
    The ras_width and ras_height are the width and height of the image given pixels.
    The ras_depth is the number of bits used per pixel (1, 8, or 24).
    The ras_length is the number of bytes used to store the data of the image.
    The ras_type field is one of the following:
            RT_OLD          0   -- Raw pixrect image in 68000 byte order
            RT_STANDARD     1   -- Raw pixrect image in 68000 byte order

    For historical reasons, files of type RT_OLD will usually have a 0 in the ras_length field and therefore the actual image length will need to be computed.

    The ras_maptype will be one of the following:
            RMT_NONE        0   --ras_maplength is expected to be 0
            RMT_EQUAL_RGB   1   --red[ras_maplength/3],green[],blue[]
            RMT_RAW         2   --Sun's registered maptype

REQUIRED ARGUMENTS

-i  type: infile
    desc: input VIFF image file

-o  type: outfile
    desc: resulting output image (raster file)

OPTIONAL ARGUMENTS

-p  type: boolean
    desc: if yes, invert image (photonegative); if no (default) do not invert image (photopositive)
    default: false

EXAMPLES
viff2rast -i viff.image -o rast.image

viff.image is any BYTE image in VIFF format. The result is a SUN raster image called rast.image.

SEE ALSO
intro(1), verror(3), vgparms(3), vutils(3), lviff2rast(3)
vconvert(1), vfileinfo(1)

RESTRICTIONS
This routine will only accept BYTE or BIT VIFF images. The resulting SUN raster image will be in IEEE or Big Endian byte order regardless of the machine type executed on.

COPYRIGHT
Copyright 1991, University of New Mexico. All rights reserved.