ppmtobmp

Convert PPM images to BMP format

TLDR

Convert PPM to BMP
$ ppmtobmp [input.ppm] > [output.bmp]
Create Windows BMP
$ ppmtobmp -windows [input.ppm] > [output.bmp]
Create OS/2 BMP
$ ppmtobmp -os2 [input.ppm] > [output.bmp]
Force 8 bits per pixel
$ ppmtobmp -bpp 8 [input.ppm] > [output.bmp]

SYNOPSIS

ppmtobmp [-windows|-os2] [-bpp n] [-mapfile file] [ppmfile]

DESCRIPTION

ppmtobmp converts PPM images to BMP (Windows/OS2 bitmap) format. Part of Netpbm toolkit for image format conversion.

PARAMETERS

-windows

Produce a Microsoft Windows BMP file. This is the default (since August 2000).
-os2
Produce an OS/2 BMP file.
-bpp bits
Bits per pixel in the output: 1, 4, 8, or 24. By default ppmtobmp picks the smallest value that can represent all colors in the input.
-mapfile file
Use the given file as the BMP palette (colormap) instead of computing one automatically. Useful when you need specific palette index values.

INSTALL

sudo apt install netpbm
sudo dnf install netpbm
sudo pacman -S netpbm
sudo apk add netpbm
sudo zypper install netpbm
brew install netpbm
nix profile install nixpkgs#netpbm

SEE ALSO

bmptopnm(1), pnmtopng(1)