From 7979dd9cc3d2c3c2782cdabc2411b3acf7b7d5f2 Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 26 Feb 2021 10:17:12 +0530 Subject: init with spec info --- spec.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 spec.md (limited to 'spec.md') diff --git a/spec.md b/spec.md new file mode 100644 index 0000000..7f455e2 --- /dev/null +++ b/spec.md @@ -0,0 +1,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`. -- cgit v1.2.3