## Index of OpenRM - RMI Library

     RMimage * rmiReadPPM (const char *  filename,
    	               RMenum        format,
    		       unsigned char alpha)

     char * filename - filename of PGM/PPM image file to read
     RMenum format - image format: RM_IMAGE_ALPHA, RM_IMAGE_LUMINANCE,
         RM_IMAGE_RGB, RM_IMAGE_RGBA
     unsigned char alpha - alpha for RMimage [0..255]

Read in a PGM/PPM file and return a handle to the RMimage object created from the image file.

Certain simplifying assumptions are made about the file format:

        image header
           - the magic number
           - comments (lines starting with "#") may follow
           - the width and height follow, delineated by whitespace
           - comments may follow
           - maximum value parameter follows, delineated by whitespace

           P3
           # this is an example 128x128 PPM file (8-bit RGB pixels)
           128 128
           255
           [image data]

        image pixels
           - ASCII lines may be no more than 70 characters (PBM/PGM/PPM spec)
           - image data is assumed to be ordered top to bottom, left to right

The following RMimage formats are supported: RM_IMAGE_ALPHA, RM_IMAGE_LUMINANCE, RM_IMAGE_RGB, RM_IMAGE_RGBA

The user-specified image format controls how the image is read in as an RMimage:

        PGM files: map directly to RM_IMAGE_ALPHA + RM_IMAGE_LUMINANCE
                   channel replicated RGB to RM_IMAGE_RGB
                   channel replicated RGB to RM_IMAGE_RGBA with alpha

        PPM files: image luminance to RM_IMAGE_ALPHA + RM_IMAGE_LUMINANCE
                   map directly to RM_IMAGE_RGB
    	       map directly to RM_IMAGE_RGBA with alpha

Currently, pixels must have type RM_UNSIGNED_BYTE.

librmi library source file: rmppm.c

     RMenum rmiWritePPM (const char *    filename,
    	             int             type,
    	             const RMimage * image)

     const char * filename - filename for RMimage write
     int type - image file type (RMI_PPM_ASCII or RMI_PPM_BINARY)
     const RMimage * image - image to write

Write the user-supplied RMimage to a PGM/PPM image file. The type of file written is inferred from the RMimage format and user-supplied type. Returns RM_CHILL upon success, or RM_WHACKED upon failure.

The following RMimage formats are supported by PBM/PGM/PPM files:

        RM_IMAGE_ALPHA, RM_IMAGE_LUMINANCE (output as PGM)
        RM_IMAGE_RGB (outputs as PPM)
        RM_IMAGE_RGBA (outputs as PPM, alpha discarded)

The file format follows the PGM/PPM spec, as described in the docs for rmiWritePPM ().

Currently, pixel components must have type RM_UNSIGNED_BYTE.

librmi library source file: rmppm.c