PCX

Picture Exchange ( PCX) is a file format for storing image data.

The PCX format was developed in 1982 by the company ZSoft and used in its own products Paintbrush and FRIEZE ( such as Lotus 1-2-3 Resident utility to import images from other applications). Today the format is supported by most graphics programs.

There were only Hercules and CGA graphics adapter At the time of development of PCX. Over the years, the graphics cards are better and new graphics modes emerged ( EGA, MCGA, VGA). These were then covered by newer versions of the PCX format. However, the changes in the format definition were essentially limited to the color palette.

Building a PCX file

General Structure

Header

Possess PCX files, regardless of version, a 128 -byte header.

Image data

Without compressing each color byte is an index ( reference) on the color palette. With compression and length bytes are possible, specify how often to repeat the following color byte is ( run length encoding). The compression is therefore particularly effective in graphs with large areas of single color. Length bytes are recognized by the fact that their two highest bits are set. With the remaining bits of the length is specified so that the maximum specifiable length is 63 bytes. Individual color bytes can be specified directly. Only if its value is 192 or more, they must be listed with a preceding length byte with the value 193, since they would otherwise be interpreted as a length byte.

Color palette

Color palettes with more than 16 colors are listed after the image data. In this case, a byte with the value 12 is inserted between image data and palette. Then follow consecutively for each color index of three color bytes for the RGB value.

18260
de