ppmtopbm
Convert PPM image to PBM image
SYNOPSIS
ppmtopbm [ppmfile]
PARAMETERS
ppmfile
The input PPM file. If not specified, ppmtopbm
reads from standard input.
DESCRIPTION
The ppmtopbm
command in Linux converts a Portable Pixmap (PPM) image file into a Portable Bitmap (PBM) image file.
PPM is a relatively simple image format that stores color information as RGB values, while PBM is a black and white (binary) image format. As such, ppmtopbm
essentially performs a thresholding operation, where each pixel in the PPM image is converted to either black or white based on its luminance.
The command reads a PPM image from standard input or a specified file and writes the resulting PBM image to standard output. This command is primarily used for converting color images to black and white for applications or devices that only support binary images. The output can then be used by other tools or programs that require a PBM file as input.
By default, the threshold for converting color values to black and white is set to the midpoint of the brightness range; however, this can't be controlled by the end user.
FILE FORMAT CONVERSION
ppmtopbm
converts a color image (PPM) to a black-and-white image (PBM). Since information is lost during the conversion, the PBM format takes less space than PPM format.
STANDARD INPUT/OUTPUT
If an input file is not explicitly specified, ppmtopbm
will read image data from standard input. The resulting PBM image will be written to standard output.