pgm
Process Portable Graymap images
SYNOPSIS
No standalone 'pgm'; use prefixed tools e.g.
pgmtext [-width n] [-height n] [-background val] textfile > output.pgm
DESCRIPTION
The pgm command is not a standard standalone executable in Linux distributions. It refers to a family of utilities in the Netpbm graphics package for handling Portable Graymap (PGM) files, a simple grayscale image format.
PGM is part of the PNM suite (PBM, PGM, PPM), designed as a minimal, portable format for grayscale images. ASCII PGM files begin with P2 header, binary with P5. Tools enable creation, editing, conversion, and analysis of PGM images, such as generating text (pgmtext), adding noise (pgmnoise), or normalizing brightness (pgmnorm).
Netpbm must be installed to use these. Common workflow: convert other formats to PGM via pnmtopgm, manipulate, then export. Ideal for scripts and batch processing due to simplicity and lack of patents.
CAVEATS
'pgm' alone does not exist; specify full tool name like pgmtext(1). Requires netpbm package.
INSTALLATION
Debian/Ubuntu: sudo apt install netpbm
Fedora/RHEL: sudo dnf install netpbm-progs
EXAMPLE USAGE
pgmtext 'Hello' > hello.pgm
pnmtopgm image.png > image.pgm
HISTORY
PGM format created by Jef Poskanzer in 1988 for PBMPLUS toolkit. Evolved into portable Netpbm project (1991+), maintained by Bryan Henderson. Widely used in image processing, computer vision.


