pbm
Process portable bitmap images
SYNOPSIS
Since there isn't a single "pbm" command, this synopsis illustrates a common PBM-related utility, pbmtoascii, which converts a PBM image into ASCII art.
pbmtoascii [-2x2] [-compact] [-rows N] [-cols N] [pbmfile]
PARAMETERS
-2x2
Produces 2x2 characters for each pixel, giving higher resolution ASCII art.
-compact
Uses a smaller character set for a more compact output.
-rows N
Specifies the maximum number of rows for the output.
-cols N
Specifies the maximum number of columns for the output.
pbmfile
The input PBM file. If not specified, reads from standard input.
DESCRIPTION
pbm primarily refers to the Portable BitMap image format, a very basic, monochrome (black & white) raster image format. It is also part of the larger Netpbm suite of graphics tools. The Netpbm project provides a collection of commands for converting, manipulating, and creating images in the PBM, PGM (Portable Graymap), and PPM (Portable Pixmap) formats. While there isn't a single "pbm" command that acts as a general utility, many specific commands within the Netpbm suite deal directly with PBM files (e.g., pbmtoascii, pbmmake, pbmflip). These tools are fundamental for basic image processing in a Unix-like environment, often used in scripts for simple graphical tasks, enabling pipelines where the output of one image tool becomes the input of another. They are designed for simplicity and interoperability.
CAVEATS
It's important to understand that "pbm" in the context of Linux commands typically refers to the Portable BitMap image format and a family of specialized tools within the Netpbm suite, rather than a single general-purpose executable command named pbm itself. Each specific PBM operation (like creating, converting, or manipulating) is handled by its own dedicated command (e.g., pbmmake, pbmtoascii, pbmflip). Users looking for general PBM manipulation should consult the various commands beginning with "pbm" or the overarching netpbm(1) man page for a comprehensive overview of the entire suite.
THE PORTABLE BITMAP (PBM) FORMAT
The PBM format (pbm(5)) is the simplest of the Netpbm formats. It represents a single-bit-per-pixel monochrome image, meaning each pixel is either black or white. It's stored as a plain text (ASCII) or raw binary file. The header specifies the "magic number" (P1 for ASCII, P4 for raw), width, and height. Following the header are the pixel values (0 for white, 1 for black in ASCII; packed bits in raw). Its simplicity makes it easy to generate and parse programmatically, making it ideal for command-line manipulation.
HISTORY
The Netpbm suite, which includes tools for the PBM format, originates from the pbmplus package developed by Jef Poskanzer in the late 1980s. It was designed to be a "toolkit approach" to image manipulation, where many small, specialized programs could be chained together using Unix pipes, rather than a single monolithic program. The PBM (Portable BitMap), PGM (Portable Graymap), and PPM (Portable Pixmap) formats were created specifically to be simple, easily parseable, and suitable for piping between these tools, serving as a "lowest common denominator" for image data. This modular design has ensured its longevity and widespread use in scripting and command-line image processing on Unix-like systems.