LinuxCommandLibrary

bmptopnm

Convert BMP images to PNM format

TLDR

Generate the PBM, PGM, or PNM image as output, for Windows or OS/2 BMP file as input

$ bmptopnm [path/to/file.bmp]
copy

Report contents of the BMP header to stderr
$ bmptopnm [[-verb|-verbose]] [path/to/file.bmp]
copy

Display version
$ bmptopnm [[-v|-version]]
copy

SYNOPSIS

bmptopnm [-alphacolor <color>] [-verbose] [file]

PARAMETERS

-alphacolor <color>
    When the BMP file has an alpha channel or transparent palette entries, this option combines transparent pixels with the specified <color> background, producing a PGM/PPM image without an alpha channel. The <color> format is defined by pnm_parsecolor().

-verbose
    Prints detailed information about the BMP file format to standard error during processing.

DESCRIPTION

bmptopnm reads a Microsoft Windows Version 3 BMP file and converts it into a portable anymap (PNM) format. It supports various BMP formats including 24-bit, 8-bit, 4-bit, and 1-bit uncompressed images, as well as 8-bit and 4-bit RLE compressed images. The command also handles palette transparency for indexed color images and alpha channels for 24-bit images. Input can be a specified file or standard input, and output is always written to standard output. It is important to note that bmptopnm does not support OS/2 BMP files or newer Version 4 BMP files. This utility is a component of the Netpbm package.

CAVEATS

bmptopnm is limited to handling Microsoft Windows Version 3 BMP files. It does not support OS/2 BMP files or newer Version 4 BMP files.

INPUT/OUTPUT

Input for bmptopnm can be provided as a file path on the command line or, if no file is specified, from standard input. The converted portable anymap (PNM) output is consistently written to standard output.

HISTORY

Part of the Netpbm project, bmptopnm's initial copyright is from 1991 by Jef Poskanzer. It serves as a foundational tool within the Netpbm suite for BMP file manipulation.

SEE ALSO

pnm(5), pnm_parsecolor(3), anytopnm(1), pnm(1), ppmtobmp(1)

Copied to clipboard