pcxtoppm
Convert PCX image files to PPM format
TLDR
Convert a PCX file to a PPM image
Use a predefined standard palette even if the PCX file provides one
Print information on the PCX header to stdout
SYNOPSIS
pcxtoppm [-verbose] [-alphaout={alphafile.pgm,none}] [pcxfile]
PARAMETERS
-verbose
Prints processing details, like image dimensions and version, to stderr.
-alphaout={alphafile.pgm,none}
Writes alpha channel (if present) to specified PGM file; use 'none' to skip.
DESCRIPTION
pcxtoppm is a utility from the Netpbm graphics toolkit that converts PCX image files to PPM (Portable Pixmap) format.
PCX, originally developed by ZSoft for PC Paintbrush in the 1980s, was widely used for screenshots, icons, and games on MS-DOS systems. It features run-length encoding (RLE) compression and supports monochrome, grayscale, paletted (up to 256 colors), and truecolor (24-bit RGB in version 5) images.
The tool reads a PCX file from standard input or a specified filename and outputs a color PPM image to standard output. It automatically handles decompression, palette expansion for indexed images, and dimension checks (up to 16,384x16,384 pixels, though older files are smaller).
pcxtoppm supports PCX versions 2.5 through 5, ignoring headers for unsupported formats. It preserves image data faithfully, converting palettes to full RGB where needed. Optional verbose mode aids debugging, and alpha channel extraction is available for extended PCX variants, though standard PCX lacks transparency.
CAVEATS
Supports only PCX v2.5-v5; proprietary extensions or v6+ may fail. No grayscale PPM output (forces color). Large images limited by memory.
USAGE NOTES
If no pcxfile, reads from stdin. Output always PPM to stdout; redirect for files, e.g., pcxtoppm image.pcx > image.ppm.
HISTORY
Developed in the Netpbm project by Jef Poskanzer (1988 onward); pcxtoppm added early for DOS-era image conversion, maintained through Netpbm 10+ releases.


