aboutsummaryrefslogtreecommitdiff
path: root/readme.md
blob: 7f455e24cda620b3162be2c2d9b3b9f323af081b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# One Bit Image

The One Bit Image is a file format to store single bit depth
images, similar to 1-bit BMP files. It is a learning
adventure and does not aim to be ubiquitous or
well-performing. The name is shortened to `obi`, any files
that wish to be identified as this format may use the file
extension `.obi`, for example: `apple.obi`.

## Technical Specification

The file format consists of the following sections:

 - File Header: 10 bytes, 0x0000 - 0x00A0
 - Image Information Header: 16 bytes, 0x00A0 - 0x01A0
 - Pixel data: Variable, 0x1A0 - Variable

### File Header (10 bytes)

This header contains the following metadata about the file
itself:

 - OBI version (2 bytes, 0x0000)
 - File size in bytes (4 bytes, 0x0020)
 - Data offset: Offset from the beginning of the file to the
   beginning of bitmap data (4 bytes, 0x0060)

### Image Information Header (16 bytes)

This header contains metadata about the image:

 - Width: Horizontal size of the bitmap data in pixels (4
   bytes, 0x00A0).
 - Height: Vertical size of the bitmap data in pixels (4
   bytes, 0x00E0).
 - Compression Algorithm: The following types of compression
   are supported: RLE, Kosinki etc. Set 0 if no compression
   (4 bytes, 0x0120).
 - Image size after compression (set 0 if no compression,
   i.e., Compression=0). (4 bytes, 0x0160)

### Pixel Data (ImageInformationHeader.Width * ImageInformationHeader.Height bytes)

The image data. Each pixel is a single bit, the size of
Pixel Data is given by `Width * Height`.