iBored is a disk sector editor for Mac OS X, Windows and Linux.
This project describes the compressed image file format and includes C code to decompress it.
The original (current) version of this file
Note: All values are in little-endian format.
Current version: 2
The file extension should be: .iboredimg
The file shall be considered read-only after creation, because the format currently does not provide an efficient way of updating data inside the image as there's not enough information in it to manage reallocation of overwritten data. Therefore, this is primarily a format for archiving.
The file format consists of several sections:
Note: Values starting with "$" mean hex values.
Offset $00-$57: File Identifier
69 42 6F 72 65 64 20 63 6F 6D 70 72 65 73 73 65 64 20 64 69 73 6B 20 69 6D 61 67 65 0D 68 74 74 70 3A 2F 2F 67 69 74 68 75 62 2E 63 6F 6D 2F 74 65 6D 70 65 6C 6D 61 6E 6E 2F 69 42 6F 72 65 64 2D 63 6F 6D 70 72 65 73 73 65 64 2D 64 69 73 6B 2D 69 6D 61 67 65 0D 00
The ASCII representation is:
iBored compressed disk image<CR> http://github.com/tempelmann/iBored-compressed-disk-image<CR><NUL>
Optional. JSON formatted non-critical information text, e.g. about the source disk.
A Chunk is a segment from the original disk image, with length of Chunk Size, starting at the offset of a whole multiple of Chunk Size. As the disk image's size is not necessarily a multiple of Chunk Size, the last chunk may be shorter.
The compressed chunks are stored inside this file anywhere past the header and in any order.
Starting with version 2, each compressed chunk starts with a uint32 value specifying the size of the compressed chunk data that follows. In version 1, this value is missing and the compressed data starts right away.
Value 1: Every chunk is compressed using using zlib "deflate" (windowBits=15). The data includes the 2-byte header and 4-byte Adler checksum.
Value 2: Every chunk is "Run Length" (RLE) compressed.
This is an RLE compression.
If a chunk can not be RLE-compressed at all, it'll be 32 bytes more in length than the original data.
This is a simple array of uint64 values, each specifying the file offset in this file to a compressed chunk. The number of array elements equals the formula:
element count = (Uncompressed Disk Image Size + Chunk Size - 1) / Chunk Size
The array elements are in order of the original disk image's chunks, so that the first array element identifies the first disk chunk and the last element identifies the last chunk.