


IMRPNM(3IM)            SDSC IMAGE LIBRARY             IMRPNM(3IM)



NAME
     imrpnm - PBM+ suite RPNM file translation

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

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

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

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

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


DESCRIPTION
     rpnm  image  files  are  used  by  various  tools   in   Jef
     Poskanzer's  PBM+ tool suite.  See the PBM documentation set
     for details on how to use these tools.

FILE RECOGNITION
     rpnm files are recognized by the filename suffix:  .rpnm.

NOTES
     SDSC image library support  of  the  rpnm  format  does  not
     require  use  of  the PBM+ libraries and tools.  It does not
     contain proprietary code or any code  from  Jef  Poskanzer's
     original  PBM+  suite.  rpnm format handling is available on
     any machine for which the SDSC image library is available.

     PBM (Portable Bit Map) started with support for 1-bit  mono-
     chrome images (see impbm(3IM)).  Support was added for 8-bit
     grayscale images (see impgm(3IM)), also called PGM (Portable
     Grayscale Map), and 24-bit RGB images (see imppm(3IM)), also
     called PPM (Portable Pixel Map).  Each of  these  defined  a
     new file format.





SDSC              Last change: August 19, 1992                  1






IMRPNM(3IM)            SDSC IMAGE LIBRARY             IMRPNM(3IM)



     The original file formats were ASCII.  To  reduce  the  disk
     space  required  to store such files, three additional "raw"
     formats were defined.   The  raw  formats  stored  the  same
     information  as  their  ASCII  counterparts  but  in binary,
     reducing the disk space requirement by around 60%.

     Today the PBM+ suite contains six related file formats:

          PBM    ASCII 1-bit bitmaps
          PGM    ASCII 8-bit grayscale pixel maps
          PPM    ASCII 24-bit RGB color pixel maps
          RPBM   Raw binary 1-bit bitmaps
          RPGM   Raw binary 8-bit grayscale pixel maps
          RPPM   Raw binary 24-bit RGB color pixel maps

     The original PBM suite included a variety  of  tools.   Some
     handled  PBM  files, but not PGM or PPM.  Others handled PGM
     files, but not PBM or PPM.  Then the newer PBM+ distribution
     introduced  a set of tools that recognized all six file for-
     mats.  These tools generically referred to  image  files  as
     PNM files, which stands for "Portable aNy Map."

     The SDSC image library treats  the  six  PBM+  file  formats
     separately.   However,  to  be  compatible with the apparent
     trend in the PBM+ toolset, the  new  generic  pnm  and  rpnm
     names  mean  "any  of the PBM+ formats."  This man page only
     discusses the RPNM generic  filename.   The  remaining  file
     formats are discussed in their own man pages.

  Reading RPNM image files
     The SDSC image library can read any of the PBM+ file formats
     when  the rpnm format name is used, including the ASCII for-
     mat variants and the raw binary variants.   PBM+  files  are
     read in and mapped to VFBs as follows:

          File format   Depth/color         Mapped to VFB
          PBM           1-bit monochrome    IMVFBMONO without a CLT
          PGM           8-bit color index   IMVFBINDEX8 without a CLT
          PPM           24-bit RGB          IMVFBRGB without a CLT
          RPBM          1-bit monochrome    IMVFBMONO without a CLT
          RPGM          8-bit color index   IMVFBINDEX8 without a CLT
          RPPM          24-bit RGB          IMVFBRGB without a CLT

     Header white space, and comments starting with # and extend-
     ing  to  the  end  of the line are ignored.  White space and
     comments are not allowed within the raw binary image body.

  Writing RPNM image files
     The SDSC image library can write PBM+  suite  files  in  the






2                 Last change: August 19, 1992               SDSC






IMRPNM(3IM)            SDSC IMAGE LIBRARY             IMRPNM(3IM)



     following configurations:

          Mapped from VFB             Depth/color         File format
          IMVFBMONO without a CLT     1-bit monochrome    RPBM
          IMVFBINDEX8 without a CLT   8-bit color index   RPGM
          IMVFBRGB without a CLT      24-bit RGB          RPPM

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

     The PBM+ suite files support no compression schemes.

     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),  rpnm  file
     reading returns the following error codes:

          IMEMAGIC    Bad magic number in image file
          IMEMALLOC   Cannot allocate enough memory
          IMESYNTAX   Premature EOF
          IMESYS      System call error in read operation

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

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

DOCUMENTATION
     pbm(5), pgm(5), and ppm(5) from the PBM+ man page set.

SEE ALSO
     ImIntro(3IM),   ImErrNo(3IM),   imconv(1IM),    imfile(1IM),
     imformats(1IM),    impbm(3IM),    impgm(3IM),    impnm(3IM),
     imppm(3IM), imrpbm(3IM), imrpgm(3IM), imrppm(3IM)

AUTHORS
     Dave Nadeau and Don Doering
     San Diego Supercomputer Center

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









SDSC              Last change: August 19, 1992                  3



