ImageGear for C and C++ on Linux v18.10 - Updated
PPM
User Guide > File Formats and Compressions > File Formats > File Formats Reference > PPM

Full Name PPM (Portable Pixmap File Format)
Format ID IG_FORMAT_PBM = 28 (See the Note below)
File Extension(s) *.ppm
Data Type Raster Image
Data Encoding Binary
Color Profile Support No
Multi-Page Support No
Alpha Channel Support No
ImageGear Platforms Support WIN32, WIN64, Unix, Unix64, .NET, .NET64, MAC
ImageGear supports PPM file format via its IG_FORMAT_PBM format filter. Use IG_FORMAT_PBM to save truecolor images to PPM format.

ImageGear Supported Versions:

October 1991 - last release

ImageGear Supported Features:

ImageGear Read Support:

ImageGear Write Support:

ImageGear Filter Control Parameters:

None

Comments:

The PPM format is useful for quick and easy transfer of color bitmap images. This format, as well as the PBM, PGM, and PNM formats, are at the core of a set of utility programs also written by Jef Poskanzer. These formats serve as intermediary storage methods for the conversion of other file formats. For example, a function called gifftoppm translates a GIF file to a PPM, where it can translate to a TIFF using the pnmtotiff.

The Portable Pixmap File Format structure is very simple. It begins with a short ASCII header that contains the file type identifier (magic number), the width and height of the image, a "maximum color-component value", and perhaps a comment line identifying the filename. Following white space (usually a carriage return) is the bitmap data. The number of pixels is equal to width * height, with each pixel being represented by three bytes: one each for Red, Green, and Blue color components, respectively.

The magic number of the header can have one of two values: either P3 or P6. P3 indicates that the bitmap data is read as ASCII decimal values. P6 indicates that the bitmap data is stored as plain bytes. This makes for a smaller and faster-to-read file.

If the maximum gray value exceeds 255 (28 = 256 gray values from 0 to 255), each pixel is represented by three 16-bit RGB samples, making a total of 48 bits per pixel. ImageGear loads such images to 24-bit RGB.

See Also:

PGM, PBM, PNM

References Used:

Kay, David C. and John R. Levine. Graphics File Formats, 2nd ed. Windcrest /McGraw-Hill, 1995.

PPM Specification by Jef Poskanzer, copyright © 1989, 1991.