


IMRAS(3IM)             SDSC IMAGE LIBRARY              IMRAS(3IM)



NAME
     imras - Sun Rasterfile translation

SYNOPSIS
     #include <stdio.h>
     #include "sdsc.h"
     #include "im.h"

     int ImFileRead( fd, "ras", flagsTable, dataTable )
          int         fd;
          TagTable   *flagsTable;
          TagTable   *dataTable;

     int ImFileFRead( fp, "ras", flagsTable, dataTable )
          FILE         *fp;
          TagTable   *flagsTable;
          TagTable   *dataTable;

     int ImFileWrite( fd, "ras", flagsTable, dataTable )
          int         fd;
          TagTable   *flagsTable;
          TagTable   *dataTable;

     int ImFileFWrite( fp, "ras", flagsTable, dataTable )
          FILE         *fp;
          TagTable   *flagsTable;
          TagTable   *dataTable;


DESCRIPTION
     ras image files are used by various  Sun  Microsystems  Inc.
     tools, such as screendump(1) and screenload(1).  See the Sun
     documentation set for details on how to use these tools.

FILE RECOGNITION
     Sun ras  files  are  recognized  by  any  of  the  following
     filename suffixes: .ras, .scr, .sr, and .sun.

NOTES
     SDSC image library support of the Sun ras  format  does  not
     require  use  of Sun's pixrect library or hardware, and con-
     tains no proprietary  code.   Sun  ras  format  handling  is
     available on any machine for which the SDSC image library is
     available.

  Reading Sun Rasterfiles
     The SDSC image library can read Sun ras files and  map  them
     to VFBs as follows:

          Depth/color         Type of compression     Mapped to VFB
          1-bit monochrome    RT_OLD, RT_STANDARD,    IMVFBMONO
                              or RT_BYTE_ENCODED



SDSC              Last change: August 19, 1992                  1






IMRAS(3IM)             SDSC IMAGE LIBRARY              IMRAS(3IM)




          8-bit color index   RT_OLD, RT_STANDARD,    IMVFBINDEX8
                              or RT_BYTE_ENCODED

          24-bit RGB          RT_OLD, RT_STANDARD,    IMVFBRGB
                              or RT_BYTE_ENCODED

          32-bit RGB-Alpha    RT_OLD, RT_STANDARD,    (IMVFBRGB | IMVFBALPHA)
                              or RT_BYTE_ENCODED

     All depths may or may not contain a color map (color  lookup
     table,  or CLT), though, normally, only 8-bit images include
     one.

     In SDSC image library terminology,  RT_STANDARD  and  RT_OLD
     files    are   uncompressed;   RT_BYTE_ENCODED   files   use
     runlength-encoded RLE compression.

     If the file's image has a color map, the image  library  VFB
     includes a CLT.

  Writing Sun Rasterfiles
     Images to be written out are mapped from image library  VFBs
     as follows:

          Mapped from VFB           Depth/color         Types of compression
          IMVFBMONO                 1-bit monochrome    RT_STANDARD, RT_BYTE_ENCODED
          IMVFBINDEX8               8-bit color index   RT_STANDARD, RT_BYTE_ENCODED
          IMVFBRGB                  24-bit RGB          RT_STANDARD, RT_BYTE_ENCODED
          (IMVFBRGB | IMVFBALPHA)   32-bit RGB-Alpha    RT_STANDARD, RT_BYTE_ENCODED

     If the incoming VFB has a CLT, the image written to the ras-
     ter file contains a color map.

     In SDSC image library terminology,  RT_STANDARD  and  RT_OLD
     files    are   uncompressed;   RT_BYTE_ENCODED   files   use
     runlength-encoded RLE compression.  RT_OLD raster files can-
     not be generated.

     RGB and RGB-Alpha images  are  always  stored  noninterlaced
     (i.e.,  RGBRGBRGB...).  Scanline- and plane-interlaced modes
     are not available in the ras format.

     Other image library VFB types are converted to  one  of  the
     above   types   prior   to  being  written  out.    See  the
     ImFileWrite(3IM) man page for details.

ERRORS
     In addition to those listed  for  ImFileRead(3IM),  Sun  ras






2                 Last change: August 19, 1992               SDSC






IMRAS(3IM)             SDSC IMAGE LIBRARY              IMRAS(3IM)



     file reading returns the following error codes:

          IMECLTLENGTH   CLT length in file header is strange
          IMEDEPTH       Unknown image depth in file header
          IMEIMAGETYPE   Unknown image type in file header
          IMEMAGIC       Bad magic number in image file
          IMEMALLOC      Cannot allocate enough memory
          IMESYNTAX      Unknown CLT type in file header
          IMESYS         System call error in read operation

     In addition to those listed for  ImFileWrite(3IM),  Sun  ras
     file writing returns the following error codes:

          IMEMALLOC   Cannot allocate enough memory
          IMESYS      System call error in write operation

DOCUMENTATION
     See the comments in /usr/include/rasterfile.h  on  Sun  sys-
     tems.

     _P_i_x_r_e_c_t _R_e_f_e_r_e_n_c_e _M_a_n_u_a_l, Sun Microsystems.

SEE ALSO
     ImIntro(3IM),   ImErrNo(3IM),   imconv(1IM),    imfile(1IM),
     imformats(1IM), imiff(3IM)

AUTHOR
     Dave Nadeau
     San Diego Supercomputer Center

CONTACT
     SDSC consultants, (619)534-5100, consult@y1.sdsc.edu























SDSC              Last change: August 19, 1992                  3



