pbmtoppm
Convert PBM image files to PPM
SYNOPSIS
pbmtoppm [-white] [-black] [-color <colorname>] [-rgb <r>,<g>,<b>] [-background <colorname>] [-bg <r>,<g>,<b>] [pbmfile]
PARAMETERS
pbmfile
The input PBM file to be converted. If omitted, pbmtoppm reads from standard input.
-white
Sets the color for the 'white' pixels of the input PBM image. Default is white. This option can be followed by a color name or RGB values.
-black
Sets the color for the 'black' pixels of the input PBM image. Default is black. This option can be followed by a color name or RGB values.
-color <colorname>
An alias for -black. Specifies the color for the 'black' pixels using a named color (e.g., "red", "blue").
-rgb <r>,<g>,<b>
An alias for -black. Specifies the color for the 'black' pixels using 24-bit RGB values (0-255 for each component).
-background <colorname>
An alias for -white. Specifies the color for the 'white' pixels using a named color.
-bg <r>,<g>,<b>
An alias for -white. Specifies the color for the 'white' pixels using 24-bit RGB values.
DESCRIPTION
pbmtoppm is a utility from the Netpbm suite designed to convert a Portable Bitmap (PBM) image into a Portable Pixmap (PPM) image. A PBM image is monochrome (black and white), while a PPM image supports full color. This command allows you to define which colors the 'black' and 'white' pixels of the input PBM should be mapped to in the resulting PPM. By default, black PBM pixels become black in the PPM, and white PBM pixels become white. However, you can specify custom colors using named colors (e.g., "red", "blue") or explicit RGB values. The output is always written to standard output, and input is read from a specified file or standard input.
CAVEATS
Only one option can be used to set the color for 'black' pixels (-black, -color, or -rgb). Similarly, only one option can set the color for 'white' pixels (-white, -background, or -bg). If multiple are specified for the same pixel type, the last one on the command line takes precedence. Named colors are resolved via the system's rgb.txt file (e.g., /usr/lib/X11/rgb.txt) or a custom rgb.txt in the current directory.
COLOR SPECIFICATION
Colors can be specified by their common names (e.g., "red", "darkgreen") which are looked up in a system-wide color database (typically /usr/lib/X11/rgb.txt), or by explicit 24-bit RGB values in the format R,G,B, where R, G, and B are integers between 0 and 255 representing the red, green, and blue components, respectively.
INPUT/OUTPUT
By default, pbmtoppm reads a PBM image from standard input (stdin) and writes the resulting PPM image to standard output (stdout). This allows for easy piping with other Netpbm commands or general shell redirection.
HISTORY
pbmtoppm is part of the Netpbm project, a comprehensive suite of graphics file format conversion tools. Netpbm originated from PBMplus, created by Jef Poskanzer in 1988. This command has been a fundamental component of the suite since its early days, facilitating conversions between basic bitmap formats and allowing for colorization of monochrome images.