Write a 24-bit PCX with correct row padding
Admin ·
Write a 24-bit PCX for software that reads RGB color planes. Pick the background color for clear and translucent pixels. Check any rotation before conversion.
Follow a 65-pixel scanline
A 65-pixel row uses 65 samples in each of its red, green and blue planes. PCX records an even number of bytes per plane per row, so this file allocates 66 bytes in each plane before run-length encoding. The extra byte is padding. A reader still displays 65 pixels.
Choose a matte before converting
A transparent corner takes the selected background color. A half-transparent line blends with the background before its RGB values are stored. To check the result, compare PCX exports with a light and a dark background.
Confirm the importer accepts three color planes
Some older workflows expect indexed artwork and a specific palette. This export has separate color planes. Opening it in a general image viewer confirms it is readable there, but only an import into the intended application checks that application’s required mode.
Use an odd-width test tile with different colors at its left and right edges. If a downstream decoder shows a diagonal shift on successive rows, check that it uses the stored padded bytes per line for each plane.
Common questions
Why do similar-sized PCX files have different byte counts?
Runs of repeated bytes compress together. A flat background generally takes fewer encoded bytes than a noisy photograph of the same dimensions.
Can I make an indexed 16-color PCX here?
The converter writes three 8-bit RGB planes. A program that specifically requires a 16-color indexed file needs a different encoding.