Netpbm formats


 * "PBM" redirects here. For another PBM format, see ILBM.
 * "PNM" redirects here. For another PNM format, see The Print Shop.

The Netpbm formats are a family of simple uncompressed raster image file formats, associated with the Netpbm library and suite of image processing utilities. They are designed so that it is straightforward for programmers to import and export them.

Due to their simplicity, the Netpbm formats are often used as "neutral" or "universal" image formats. It's not unusual for an image format's reference software to include a utility to convert to and from one of the Netpbm formats (and perhaps no other formats). Many of these conversion utilities have ultimately been incorporated into the Netpbm software.

Formats

 * PBM (portable bitmap) is a bi-level image format.
 * PGM (portable graymap) is a grayscale image format.
 * PPM (portable pixmap) is a color image format.
 * PNM (portable anymap) is a collective name for PBM, PGM, and PPM. A .pnm file may use any of those formats.
 * PAM: Refer to Portable Arbitrary Map. Although PAM is one of the Netpbm formats, it's different enough that it's best documented in a separate article.

Identifiers and Identification
Each file begins with two ASCII characters, which serve as a signature.

The PBM, PGM, and PPM formats come in two varieties: a text (or "plain" or "ASCII") format, and a binary (or "raw") format.

Multi-image files
Although the Netpbm formats are usually thought of as single-image formats, the binary formats technically do support multiple images per file. This is accomplished simply by concatenating single-image files together. Such multi-image files are probably not well-supported.

Specifications

 * PBM Format Specification
 * PGM Format Specification
 * PPM Format Specification

Software
The PBM/PGM/PPM/PNM formats are widely supported. Software listed here has been arbitrarily selected.
 * Netpbm
 * ImageMagick

Sample files

 * http://www.fileformat.info/format/pbm/sample/index.htm
 * http://samples.libav.org/image-samples/ → *.ppm, *.pgm
 * http://www.csbruce.com/cbm/ftp/images/pbm/
 * https://telparia.com/fileFormatSamples/image/pbm/
 * https://telparia.com/fileFormatSamples/image/pgm/
 * https://telparia.com/fileFormatSamples/image/ppm/

Links

 * Wikipedia: Netpbm format
 * , from the Encyclopedia of Graphics File Formats
 * Graphic describing PGM format
 * Graphic describing PPM format