aboutsummaryrefslogtreecommitdiff
path: root/spec.md
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-02-26 04:47:12 +0000
committerAkshay <[email protected]>2021-02-26 04:47:12 +0000
commit7979dd9cc3d2c3c2782cdabc2411b3acf7b7d5f2 (patch)
tree3daf3f78f75c1c95767be76cf028bc5ca951addf /spec.md
init with spec info
Diffstat (limited to 'spec.md')
-rw-r--r--spec.md45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec.md b/spec.md
new file mode 100644
index 0000000..7f455e2
--- /dev/null
+++ b/spec.md
@@ -0,0 +1,45 @@
1# One Bit Image
2
3The One Bit Image is a file format to store single bit depth
4images, similar to 1-bit BMP files. It is a learning
5adventure and does not aim to be ubiquitous or
6well-performing. The name is shortened to `obi`, any files
7that wish to be identified as this format may use the file
8extension `.obi`, for example: `apple.obi`.
9
10## Technical Specification
11
12The file format consists of the following sections:
13
14 - File Header: 10 bytes, 0x0000 - 0x00A0
15 - Image Information Header: 16 bytes, 0x00A0 - 0x01A0
16 - Pixel data: Variable, 0x1A0 - Variable
17
18### File Header (10 bytes)
19
20This header contains the following metadata about the file
21itself:
22
23 - OBI version (2 bytes, 0x0000)
24 - File size in bytes (4 bytes, 0x0020)
25 - Data offset: Offset from the beginning of the file to the
26 beginning of bitmap data (4 bytes, 0x0060)
27
28### Image Information Header (16 bytes)
29
30This header contains metadata about the image:
31
32 - Width: Horizontal size of the bitmap data in pixels (4
33 bytes, 0x00A0).
34 - Height: Vertical size of the bitmap data in pixels (4
35 bytes, 0x00E0).
36 - Compression Algorithm: The following types of compression
37 are supported: RLE, Kosinki etc. Set 0 if no compression
38 (4 bytes, 0x0120).
39 - Image size after compression (set 0 if no compression,
40 i.e., Compression=0). (4 bytes, 0x0160)
41
42### Pixel Data (ImageInformationHeader.Width * ImageInformationHeader.Height bytes)
43
44The image data. Each pixel is a single bit, the size of
45Pixel Data is given by `Width * Height`.