Skip to main content

Module ppm

Module ppm 

Source
Expand description

Netpbm images: PBM (P1, P4), PGM (P2, P5) and PPM (P3, P6).

The simplest lossless formats: a short text header (magic number, width, height and maximum value, with # comments) followed by the samples, as ASCII numbers (P1–P3) or raw bytes (P4–P6; 16-bit big-endian when the maximum exceeds 255). Bitmaps (PBM, where 1 is black) are read as 8-bit greyscale with black = 0 and white = 255. Writing produces binary PGM (one channel) or PPM (three channels).

See the book entry Image files.

Functions§

ppm_decode
Decodes any Netpbm image (P1 to P6).
ppm_encode
Encodes a one-channel image as binary PGM (P5) or a three-channel image as binary PPM (P6), with maximum value 255 or 65535 according to the bit depth.
read_ppm_file
Reads a Netpbm file.
write_ppm_file
Writes a binary PGM or PPM file.