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.