ppmtopcx
Convert PPM images to PCX format
TLDR
Convert a PPM image to a PCX file
Produce a PCX file with the specified color depth
SYNOPSIS
ppmtopcx [-24] [-padded] [-truecolor] [-transparent <color>] [-mono] [-color <numcolors>] [-map <mapfile>] [ppmfile]
PARAMETERS
-24
Outputs a 24-bit truecolor PCX, even if not explicitly requested with -truecolor.
-padded
Pads each scan line to an even byte boundary, which can be required by some PCX readers.
-truecolor
Outputs a truecolor PCX image (either 16-bit or 24-bit depending on the input and other options).
-transparent <color>
Specifies a transparent color for 8-bit paletted PCX files. The color must be provided as a hex string (e.g., #RRGGBB or #RRGGBBAA).
-mono
Outputs a monochrome (1-bit) PCX image, converting the input PPM to black and white.
-color <numcolors>
Reduces the number of colors in the output PCX image to 'numcolors' using quantization. 'numcolors' must be an integer between 2 and 256.
-map <mapfile>
Uses the colormap from the specified 'mapfile' (which should be a PPM file) instead of computing one. This is useful when you need a specific palette for the output.
ppmfile
The input PPM file. If this argument is omitted, ppmtopcx reads the PPM image from standard input (stdin).
DESCRIPTION
ppmtopcx is a command-line utility from the Netpbm image manipulation toolkit. Its primary function is to convert image files from the Portable Pixmap (PPM) format to the ZSoft PCX format. The PPM format is a simple, raw bitmap format, while PCX is a common image format used by applications like PC Paintbrush. ppmtopcx supports various features during conversion, including truecolor output, 24-bit output, specifying transparency, and monochrome conversion. It can also quantize colors to a specified number or use a custom color map, making it flexible for different PCX requirements. The command reads the PPM image from standard input if no file is specified, and writes the PCX output to standard output. This allows it to be easily integrated into shell pipelines with other Netpbm tools.
CAVEATS
When using truecolor output, the resulting PCX file might not be compatible with older PCX viewers that only support paletted images. Transparency is only applicable to 8-bit paletted PCX files, not truecolor formats. The -color option utilizes standard Netpbm quantization, which may not always yield optimal results for all images.
INPUT/OUTPUT
The command reads a PPM image from standard input by default, or from the specified ppmfile. The resulting PCX image is written to standard output. This design promotes piping and integration into larger shell scripts, allowing ppmtopcx to be part of complex image processing workflows.
COLOR MAPPING CONTROL
For paletted output, ppmtopcx attempts to use an optimized color map. However, options like -color and -map provide fine-grained control over the output palette. This is crucial for achieving desired visual quality, reducing file size, or ensuring compatibility with specific PCX readers that might expect a predefined palette.
HISTORY
ppmtopcx is an integral part of the extensive Netpbm package, a collection of graphics utilities that evolved from Jef Poskanzer's Pbmplus toolkit, initially developed in the late 1980s. Netpbm continues to be maintained and developed as a versatile tool for image manipulation. ppmtopcx specifically addresses the conversion to the PCX format, which was a widely used image format on personal computers, particularly in the MS-DOS era.