The READ_PPM procedure reads the contents of a PGM (gray scale) or PPM (portable pixmap for color) format image file and returns the image in the form of a 2D byte array (for grayscale images) or a (3, n , m ) byte array (for true-color images).
Files to be read should adhere to the PGM/PPM standard. The following file types are supported: P2 (graymap ASCII), P5 (graymap RAWBITS), P3 (true-color ASCII pixmaps), and P6 (true-color RAWBITS pixmaps). Maximum pixel values are limited to 255. Images are always stored with the top row first.
PPM/PGM format is supported by the PBMPLUS toolkit for converting various image formats to and from portable formats, and by the Netpbm package.
This routine is written in the IDL language. Its source code can be found in the file
subdirectory of the IDL distribution.