Where is the Windows BMP Format defined?


You'd think this would be simple: on MSDN surely. Even Google has trouble finding any microsoft.com site that defines the bmp file format. Here's how I found it (eventually):

I started with a printed version of the GFF book, which is ancient, but pretty good. It talks about the ugly history of BMP and various versions. It actually says "Although you probably will not be able to get any information directly from them, here is Microsoft's address". Given the age of this book, I wanted something newer, and more official.

I asked Google "bmp file format" and got all kinds of hits, none of them definitive (ie on a Microsoft site)

I asked MSDN the same and got a bunch of hits on DirectX but little else.

Eventually I took a look at the Windows source code (perk of the job) and the answer is in various (public) structure definitions. All BMPs start with a BITMAPFILEHEADER, and that is followed by a BITMAPINFOHEADER, or a BITMAPV4HEADER or occasionally a BITMAPV5HEADER. Then an optional color table, followed by the actual bits.

I learned that BI_JPEG and BI_PNG formats are supported nowadays too on modern versions of Windows. Cool. (About time frankly).

So now you know.

(To be clear, I do not claim expert status on BMPs. I did register a BMP sub-format back in the early 90s before I worked at MS, and wrote a bunch of code at the time, but it was a lifetime ago. I also am deliberatley ignoring the OS/2 flavors of BMPs-  that too was a lifetime ago).

Comments (1)

  1. 9 years later... says:

    …and all your links are broken, folks implement BMPs based on twenty years old documents, nobody knows if BI_ALPHABITFIELDS existed outside of long dead CE products, Wikipedia claims it is or was 6, Mozilla and the Gimp try or tried 4, and the one MSDN page talking about it forgot to mention the value.

Skip to main content