PCX
From GDWiki
- This article is a stub. You can help out by expanding it.
Originally developed for PC Paintbrush, an MS-DOS paint package published by ZSoft, the PCX format was licenced by Microsoft and used in the paint package supplied with Windows. Early versions of the format only supported 16 colours, this was increased to 256 when the VGA standard emerged. The final draft of the standard incorporated 24 bit RGB but fell short of including alpha channels. The format uses RLE compression and is popular with developers as it is quite easy to work with compared to formats like JPEG and PNG.
[edit] File Format
The PCX Header is 128 bytes:
BYTE ITEM SIZE DESCRIPTION **** **** **** *********** 0 ID 1 Always 0x0A 1 Version 1 v5 is the latest standard, supporting 24 bit colour 2 Encoding 1 1 = Run Length Encoding 3 BPP 1 Bits per pixel. 1, 2, 4, or 8 (see nPlanes) 4 Window 8 Image Dimensions: Xmin,Ymin,Xmax,Ymax (2 bytes each) 12 HDpi 2 Horizontal Resolution of image in DPI 14 VDpi 2 Vertical Resolution of image in DPI 16 Colormap 48 EGA palette. Ignore this unless you really want 16 colour images. 64 Reserved 1 Always 0x0. 65 NPlanes 1 Number of color planes, this will be 1 for index colour and 3 for RGB. 66 BytesPerLine 2 Number of bytes required to decode a scanline (always an even value). 68 PaletteInfo 2 1 = Color/BW, 2 = Grayscale. 70 HscreenSize 2 Screen width in pixels. 72 VscreenSize 2 Screen height in pixels. 74 Padding 54 Zero padding to fill out 128 byte header.
RLE compressed image data follows the header at offset 128.
The VGA palette data (if any) is stored in the last 768 bytes of the file, immediately preceeded by a signature byte (12 decimal).

