The format of bitmap resources

Date:April 20, 2007 / year-entry #138
Tags:code
Orig Link:https://blogs.msdn.microsoft.com/oldnewthing/20070420-00/?p=74641
Comments:    6
Summary:The next entry in the continuing sporadic series on resource formats is the bitmap. You thought accelerator tables were simple; bitmaps are even simpler. A bitmap resource takes the same form as a bmp file, except that there is no BITMAPFILEHEADER. That's all.

The next entry in the continuing sporadic series on resource formats is the bitmap. You thought accelerator tables were simple; bitmaps are even simpler.

A bitmap resource takes the same form as a bmp file, except that there is no BITMAPFILEHEADER. That's all.


Comments (6)
  1. Sebastian Redl says:

    Simple to write an article about, perhaps. The BMP file format is simple, but it isn’t exactly trivial.

  2. Chris Becke says:

    Well, the bfOffBits member of the BITMAPFILEHEADER does imply that the bitmap bits doesn’t have to follow directly after the BITMAPINFOHEADER. A bitmap resource on the other hand is strictly a packed bitmap – one where the bits follow directly after the header.

  3. cmov says:

    Yes, the documentation says: "A BITMAPINFO or BITMAPCOREINFO structure immediately follows the BITMAPFILEHEADER structure in the DIB file."

    So the BITMAPFILEHEADER structure seems pointless. Which raises the question why its used for bitmap files at all.

  4. Mike Dimmick says:

    Because someone thought when originally defining it that it might be a good idea if it could be extended, but it never has been?

    The Windows SDK is littered with unused extension points, as are probably most large systems.

  5. Mike Dunn says:

    Someone’s slacking on Friday!

    (Nitpicker’s corner: I know Raymond writes his entries a long time in advance. It’s a joke.)

    [I try to balance the daily output. A big computer entry goes with a shorter non-computer entry and vice versa. -Raymond]
  6. Andy says:

    bfOffBits refers to the beginning of the bitmap bits.  That means there can be an arbitrary amount of space between the BITMAPINFO/palette and the actual bits.  Which means you could put almost anything you want between the header and the bits, and not break properly written software.

Comments are closed.


*DISCLAIMER: I DO NOT OWN THIS CONTENT. If you are the owner and would like it removed, please contact me. The content herein is an archived reproduction of entries from Raymond Chen's "Old New Thing" Blog (most recent link is here). It may have slight formatting modifications for consistency and to improve readability.

WHY DID I DUPLICATE THIS CONTENT HERE? Let me first say this site has never had anything to sell and has never shown ads of any kind. I have nothing monetarily to gain by duplicating content here. Because I had made my own local copy of this content throughout the years, for ease of using tools like grep, I decided to put it online after I discovered some of the original content previously and publicly available, had disappeared approximately early to mid 2019. At the same time, I present the content in an easily accessible theme-agnostic way.

The information provided by Raymond's blog is, for all practical purposes, more authoritative on Windows Development than Microsoft's own MSDN documentation and should be considered supplemental reading to that documentation. The wealth of missing details provided by this blog that Microsoft could not or did not document about Windows over the years is vital enough, many would agree an online "backup" of these details is a necessary endeavor. Specifics include:

<-- Back to Old New Thing Archive Index