Captain Comic Image Format
The Captain Comic Image Format stores the full-screen EGA images used in Captain Comic, such as the title screen. The format is essentially raw EGA data compressed with a simple RLE algorithm. All images are 320×200 pixels in size.
The first two bytes are a UINT16LE indicating the decompressed size of each plane of data. This is always 8000. There are four planes in the file (in the order blue, green, red, intensity) leading to 32,000 bytes after decompression.
After these two bytes, the compressed data begins. The decompression algorithm is as follows:
- Read one byte
- If the high bit is NOT set (<= 127) then copy this many bytes unchanged
- If the high bit is set (>= 128) then repeat the next byte. The repeat count is the lower seven bits (i.e. the value minus 128)
- Repeat until EOF
40 1F 96 00 01 10 83 00 03 8A 01 23
- 40 1F: The first two bytes are the plane size (8000) and can be ignored.
- 96 00: Repeat 0x00 exactly 0x16 times (0x96 & 0x7F == 0x16)
- 01 10: Write the single byte 0x10 once
- 83 00: Repeat 0x00 three times
- 03 8A 01 23: Write the three bytes 0x8A 0x01 0x23 unchanged
When encoding/compressing a file in this format, care must be taken to ensure it is compressed in blocks of 8000 bytes (one EGA plane.) Codes cannot run across one of these boundaries or some bytes after 8000 will be lost and the image will be corrupted. If, for example, an RLE repeated byte indicates a value should be repeated 100 times from offset 7990 to 8090, it must be split into two codes. One repeating 10 times from 7990 to 8000, and the second repeating 90 times from 8000 to 8090. Likewise this must also occur at the other plane boundaries (which are all multiples of 8000, i.e. offsets 16000 and 24000.)
The following tools are able to work with files in this format.
|Name||Platform||View images in this format?||Convert/export to another file/format?||Import from another file/format?||Access hidden data?||Edit metadata?||Notes|
This file format was reverse engineered by Malvineous. If you find this information helpful in a project you're working on, please give credit where credit is due. (A link back to this wiki would be nice too!)