Format Of A .BMP Graphics File

Format Of A .BMP Graphics File

28 December 1995, dvb@echo.com, Santa Cruz

Well, I managed to reverse engineer it enough to read the few files I actually had. There are definitely variants not covered here; the files that match this description are all 8-bit uncompressed. Other options for .BMP files (as I glean from Photoshop's Save As... dialog) include 4 bit, Windows/OS2, and RLE.
This is what I found.

Note: "four byte integers" are represented with least significant byte first.
So, for example, the decimal number 1000 would appear in the byte stream
as the four hexadecimal elements E8 03 00 00.

Offset             Contents
(decimal)          (hexadecimal)
------             --------
0-2                Two ascii characters 'B', 'M', and the value E8.
3-6                Some four byte integer?
7-9                zero
10-17              36 04 00 00 28 00 00 00
18-21              four byte integer width
22-25              four byte integer height
26-45              01 00 08 00 00 00 00 00 00 00 00 00 12 0B 00 00 12 0B 00 00
46-53              zero
54-1073            256 color table entries, corresponding to pixel values 00 to FF.
                   Each color table entry consists of four bytes: BB GG RR 00.
1074-...           Pixmap data, starting from the bottom left corner of the image.
                   Pixels go from left to right, and row by row from bottom to top.
                   Each pixel represents an index into the color table. Altogether
                   there are width * height pixels, each one byte long.
1074+width*height  00 00

And that's all!

12/28/95.21:31 - 12/28/95.22:13