bmptoppm
Convert BMP images to PPM format
TLDR
View documentation for the current command
SYNOPSIS
bmptoppm [-gamma | -no-gamma-correct] [-map=mapfile] [-verbose] [bmpfile]
The bmpfile argument is optional; if omitted, bmptoppm reads from standard input.
PARAMETERS
bmpfile
The path to the input BMP file. If omitted, input is read from standard input.
-gamma
Instructs bmptoppm to perform gamma correction if the BMP file contains gamma information. This is the default behavior.
-no-gamma-correct
Disables gamma correction, even if the BMP file contains gamma information.
-map=mapfile
Maps the colors in the output image to those found in the specified mapfile, which must be a PPM file. This option implies that the output will always be PPM, regardless of input color depth.
-verbose
Prints detailed information about the input BMP file to standard error during processing.
DESCRIPTION
bmptoppm is a utility from the Netpbm project designed to convert Microsoft Windows Bitmap (BMP) image files into Netpbm formats, specifically Portable Pixmap (PPM) for color images or Portable Graymap (PGM) for grayscale images. It serves as a crucial bridge between the ubiquitous BMP format and the flexible Netpbm suite of image manipulation tools. The command handles various BMP file types, including RLE-encoded images, and intelligently determines the output format based on the input BMP's color depth.
A key feature of bmptoppm is its ability to perform gamma correction, adjusting the image brightness and contrast to ensure accurate color reproduction, which is often crucial when displaying images across different devices. By default, it applies this correction if the BMP file provides a gamma value. This command is frequently used as the first step in a larger image processing pipeline within the Netpbm ecosystem, allowing users to leverage tools like pnmscale, pnmcrop, or pnmgamma on their BMP images after conversion.
CAVEATS
While bmptoppm is robust for many BMP formats, it may not support all obscure or very old/new variations of the BMP specification. Certain less common compression types or bit depths might not be fully handled. Users should verify output for critical applications. Also, the gamma correction relies on the gamma information being present and accurate within the BMP file itself.
<I>OUTPUT FORMAT</I>
The output format is determined automatically: PPM for color or truecolor BMPs, and PGM for grayscale BMPs. If the -map option is used, the output is always PPM.
HISTORY
bmptoppm is an integral part of the Netpbm project, a comprehensive suite of graphics file format conversion and manipulation tools. The Netpbm project itself originated from the Pbmplus package, created by Jef Poskanzer in the late 1980s. bmptoppm was written by Michael K. Johnson and has been a stable component of the Netpbm suite for many years, continuously maintained and updated as part of the broader project to ensure compatibility with evolving BMP standards and operating systems.