PCX
The PCX (PiCture eXchange) format is a raster image file format developed by ZSoft Corporation in 1985 for use with its PC Paintbrush graphics software on MS-DOS systems.[1][2] It stores bitmap images with support for monochrome, indexed color (up to 256 colors), and 24-bit RGB color depths, employing run-length encoding (RLE) for lossless compression to reduce file sizes efficiently for simple graphics.[3][2] The format features a fixed 128-byte header that includes metadata such as image dimensions, bit depth, color planes, and an optional 16-color EGA palette, followed by the encoded image data and, in later versions, a 256-color VGA palette at the end of the file.[3][1] PCX gained widespread adoption in the 1980s and early 1990s due to its integration with early PC graphics applications, including Microsoft's bundling of PC Paintbrush with Windows, making it a de facto standard for clip art, screenshots, and desktop publishing on IBM-compatible PCs.[2] It evolved through several versions—from the initial 2.5 release supporting basic monochrome and 4-bit color, to version 3.0 in 1991 adding 24-bit color support and enhanced palettes—to accommodate advancing display technologies like EGA and VGA.[3][1] The format's RLE compression processes scanlines plane by plane (e.g., for RGB separation in 24-bit images), repeating bytes to handle runs of identical pixels, though it performs poorly on complex, high-detail images compared to modern alternatives.[3][2] A related multi-page variant, DCX, emerged for fax applications, allowing multiple PCX images in a single file, but PCX itself remained single-image only with a maximum resolution of 64,000 by 64,000 pixels.[2][1] By the mid-1990s, PCX was largely supplanted by more versatile formats like BMP, GIF, and JPEG, rendering it obsolete for contemporary use, though it persists in legacy software, Adobe products, and archival contexts.[1][2] Its documentation, including ZSoft's official technical reference manual, ensures partial sustainability for digital preservation, despite no formal standardization body.[3]History and development
Origins
The PCX (PiCture eXchange) file format was developed in 1985 by ZSoft Corporation, a software company founded in 1980 and based in Marietta, Georgia.[4][5] Created as the native format for ZSoft's PC Paintbrush application on MS-DOS, PCX emerged during the early era of personal computing when IBM-compatible PCs dominated the market.[6][2] Designed as a simple and efficient raster image format, PCX was tailored for the hardware limitations of the time, particularly supporting palette-indexed images suitable for color displays like CGA and EGA, which offered limited palettes of 4 to 16 colors.[2][7] This focus on compactness and quick rendering made it ideal for exchanging bitmap graphics in resource-constrained environments, predating the rise of graphical user interfaces like Windows.[4] Initial adoption of PCX was closely linked to ZSoft's graphics tools, which served business and technical applications on MS-DOS systems, including image handling for early desktop publishing and design workflows.[8] The format's release alongside PC Paintbrush version 2.5 positioned it as one of the earliest proprietary standards for personal computer image exchange, facilitating interoperability among DOS-based software before more universal formats emerged.[6][7]Versions and evolution
The PCX format originated in 1985 with version 0, corresponding to ZSoft's PC Paintbrush 2.5, which supported basic monochrome images and up to 16 colors, aligned with the limitations of early IBM PC graphics adapters like CGA and early EGA hardware.[1][2] This initial version incorporated run-length encoding (RLE) compression from the outset to optimize storage on floppy disks, achieving compression ratios of 40-70% for simple 16-color images by encoding repeated bytes efficiently.[3][2] Subsequent updates addressed evolving graphics hardware, with version 2 (PC Paintbrush 2.8) introducing palette information to enable modifiable EGA palettes for enhanced color control beyond fixed CGA sets.[1][3] Version 3, also from PC Paintbrush 2.8, omitted the palette for files without it, streamlining storage for EGA-compatible images while maintaining backward compatibility.[1] These changes reflected the transition from CGA's 4-color displays to EGA's 16-color capabilities, allowing PCX to adapt to the growing prevalence of enhanced graphics cards in the late 1980s.[2] The format reached its peak with version 5 in 1991, tied to PC Paintbrush 3.0, which added support for VGA's 256-color palettes and 24-bit true color through a multi-plane structure using three 8-bit planes for red, green, and blue channels, enabling up to 16 million colors.[1][3] This evolution culminated in PCX's broad adoption for MS-DOS applications, including scanning and faxing, as it accommodated SuperVGA extensions.[2] PCX's decline began in the early 1990s with the rise of Microsoft Windows, which favored the native BMP format for its Paint application, rendering PCX less essential despite its prior bundling via OEM deals.[2] By the mid-1990s, superior alternatives like JPEG for lossy compression and PNG for lossless web use overshadowed PCX's limitations in efficiency and multi-image support, leading to its obsolescence.[1]Supported image types
Color modes
The PCX format employs a palette-indexed approach, where pixel values act as indices into a color lookup table containing RGB entries, rather than storing direct color values; this design optimized storage and display for the constrained hardware of early personal computers, such as those with 8-bit color buses.[2] All single-plane modes in PCX rely on this indexing mechanism to map pixel data to colors defined in the palette.[9] The monochrome mode operates at 1 bit per pixel, supporting only two colors—typically black and white—for simple graphics like line art and text, which were prevalent in early applications on CGA-compatible systems.[2] In this configuration, each bit directly determines the pixel's state (on or off), drawing from a fixed two-entry palette without requiring additional color data storage.[9] A 2-bit per pixel mode provides 4 colors, suitable for early CGA graphics, and features a palette in the header to define the colors.[9][10] This mode packs four pixels across two bytes in single-plane configuration. A 4-bit per pixel mode provides 16 colors, aligning with the capabilities of CGA and EGA graphics adapters during the 1980s, and commonly features a 48-byte EGA palette embedded in the file structure to define the available colors.[2] This mode efficiently encodes two pixels per byte in big-endian order, making it suitable for icons, sprites, and low-resolution illustrations of that era.[9] The 8-bit per pixel mode accommodates 256 colors, establishing the standard for VGA mode 13h in the late 1980s and early 1990s, with the full palette—comprising 768 bytes of RGB values—appended at the file's end for comprehensive color mapping.[2] It represented a key evolution, enabling richer visual content like detailed artwork and photographs adapted to indexed displays, while remaining backward-compatible with lower-depth modes through palette subsetting.[9] Although PCX extensions support multi-plane setups for true-color imaging, the core single-plane modes emphasize palette efficiency for legacy hardware.[1]Multi-plane configurations
In the PCX format, multi-plane configurations enable higher color depths by dividing pixel data across multiple bit planes, where each plane represents a single bit position across all pixels in a scanline, allowing for packed storage of indexed colors.[9] For instance, 16-color images, commonly associated with EGA graphics, utilize four 1-bit planes per pixel, with each plane corresponding to one bit in a 4-bit color index (e.g., bits for red, green, blue, and intensity components), resulting in a total of 16 possible color combinations when combined with a 16-entry palette.[9][11] This planar arrangement stores data sequentially by plane within each scanline, with the number of planes specified in the file header.[3] For true-color representation, PCX supports 24-bit RGB images through three 8-bit planes, one dedicated to each color channel (red, green, and blue), enabling up to 16.7 million colors without relying on a palette.[9][3] These planes are ordered red, then green, then blue, and each scanline's data is encoded separately per plane before proceeding to the next.[3] This configuration, introduced in later versions of the format, provides direct color storage but is less efficient for palette-based workflows common in early computing.[2] Multi-plane configurations in PCX introduce added complexity in file decoding and storage, as data must be processed plane-by-plane rather than pixel-by-pixel, often requiring padding to even byte boundaries and careful handling of scanline boundaries.[3] Such setups are relatively rare outside of 24-bit true-color modes, with most legacy PCX files favoring simpler single-plane indexed formats for compatibility and efficiency.[9][2]File format specification
Header structure
The PCX file header is a fixed-size structure of 128 bytes located at the beginning of every PCX file, providing essential metadata for parsing the image, including identification, version, dimensions, resolution, color plane details, and an optional embedded palette.[3][12][9] This header ensures compatibility across different implementations of the format developed by ZSoft, with all multi-byte integer values stored in little-endian byte order.[9][3] The header's byte-by-byte layout is as follows:| Offset | Size (bytes) | Field Name | Description |
|---|---|---|---|
| 0 | 1 | Manufacturer | Identifier byte, always set to 0x0A (decimal 10) to indicate a ZSoft PCX file.[3][12][9] |
| 1 | 1 | Version | Version number of the PC Paintbrush software used to create the file: 0 for version 2.5, 2 for 2.8 with palette information, 3 for 2.8 without palette, 4 for Paintbrush for Windows, or 5 for version 3.0 and later (supporting 24-bit color).[3][12][9] |
| 2 | 1 | Encoding | Encoding method: 1 indicates standard run-length encoding (RLE), while 0 denotes uncompressed data (unofficial and rarely used).[3][12][9] |
| 3 | 1 | BitsPerPixel | Number of bits per pixel per plane, typically 1, 2, 4, or 8.[3][12][9] |
| 4 | 2 | Xmin | Minimum X coordinate of the image (usually 0), as a 16-bit unsigned integer.[3][12][9] |
| 6 | 2 | Ymin | Minimum Y coordinate of the image (usually 0), as a 16-bit unsigned integer.[3][12][9] |
| 8 | 2 | Xmax | Maximum X coordinate (width minus 1), as a 16-bit unsigned integer.[3][12][9] |
| 10 | 2 | Ymax | Maximum Y coordinate (height minus 1), as a 16-bit unsigned integer.[3][12][9] |
| 12 | 2 | Horizontal DPI | Horizontal resolution in dots per inch, often set to the device's DPI but considered unreliable for precise rendering.[3][12][9] |
| 14 | 2 | Vertical DPI | Vertical resolution in dots per inch, similarly unreliable.[3][12][9] |
| 16 | 48 | EGA Palette | Optional 16-color palette for EGA-compatible displays, consisting of 16 RGB triples (3 bytes each: red, green, blue values from 0 to 255), padded with zeros if unused.[3][12][9] |
| 64 | 1 | Reserved | Reserved byte, must be set to 0.[3][12][9] |
| 65 | 1 | Number of Planes | Number of color planes, typically 1 (monochrome or indexed), 3 (RGB), or 4 (CMYK).[3][12][9] |
| 66 | 2 | Bytes per Line | Number of bytes per scanline per plane, always even and padded (e.g., to a multiple of 2 or 4) regardless of actual pixel data needs.[3][12][9] |
| 68 | 2 | Palette Type | Palette interpretation: 1 for color or black-and-white, 2 for grayscale (often ignored in later versions).[3][12][9] |
| 70 | 2 | Horizontal Screen Size | Horizontal screen resolution minus 1 in pixels (introduced in PC Paintbrush IV and later; best ignored for compatibility).[3][12][9] |
| 72 | 2 | Vertical Screen Size | Vertical screen resolution minus 1 in pixels (similarly, introduced later and unreliable).[3][12][9] |
| 74 | 54 | Filler | Reserved padding bytes to reach 128 bytes total; must all be set to 0, though some implementations may include junk data.[3][12][9] |