Wasteland PIC Format
Format type | Image |
---|---|
Hardware | EGA |
Colour depth | 4-bit (EGA) |
Minimum size (pixels) | 2×1 |
Maximum size (pixels) | Unlimited |
Palette | Default EGA |
Plane count | 1 |
Transparent pixels? | No |
Hitmap pixels? | No |
Games |
All images in the game Wasteland are stored in this format, though some are stored within blocks of many images and/or Huffman encoded.
The image format does not store any transparency. Instead, masks are used to draw transparencies like the character on the world map or the mouse cursor.
Pixels are encoded with the below Vertical XOR scheme.
Storing images with Vertical XOR does not take up any additional data compared to storing raw EGA color values. It is theorised this was done as a form of obfuscation to prevent game file ripping or editing.
TITLE.PIC
The Wasteland title.pic
file is 288×128 pixels with no additional header, tail, or metadata.
Vertical XOR Encoding
The image is decoded by organizing bytes into a 2-dimensional array, then applying Exclusive OR (XOR) of a byte with the byte above it.
Because the first row does not have any row above it, the first row is XOR'ed with zero (which produces the same value).
A single byte is used to store two pixels next to each other, where each pixel is a color index into the EGA Palette.
An example of decoding a 2×4 image, 2 pixels wide by 4 pixels tall:
line | value in file | binary | XOR Operation | Result Binary | The final pixel value [and corresponding EGA colours] |
---|---|---|---|---|---|
1 | 0x32 | 0011 0010 | 0x32 ^ 0x00 | 0011 0010 | 0x32 [0x3 cyan, 0x2 green] |
2 | 0x55 | 0101 0101 | 0x55 ^ 0x32 | 0110 0111 | 0x67 [0x6 orange, 0x7 grey] |
3 | 0x00 | 0000 0000 | 0x00 ^ 0x67 | 0110 0111 | 0x67 [0x6 orange, 0x7 grey] |
4 | 0x60 | 0110 0000 | 0x60 ^ 0x67 | 0000 0111 | 0x07 [0x0 black, 0x7 grey] |