Archived

This topic is now archived and is closed to further replies.

BMP structure

This topic is 5572 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im interested to know (better) bitmap files and how they work. Now i know this, every BMP file starts whit information wich can be storet to these two stucts: BITMAPFILEHEADER bitmapfileheader; BITMAPINFOHEADER bitmapinfoheader; And in 8bit (256colors) files there can also be the palette. So how is the image buffer (rest of the file) where the actual bit data is managed? for an example i know that in 24bit one black pixel entry would be: 00 00 00 (i might be wrong). So were can i found more information about how the pixel are stored to BMP files whit difrend (8,16,24,32) color dephts? Any help is apreciated.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Or even http://msdn.microsoft.com if you are talking Windows platform.

Share this post


Link to post
Share on other sites

Still i havent quite found the answer what im looking for.

Can some one answer or point tutorial for these things:

converting 16bit BMP file to 24bit

saving 16bit LPDIRECTDRAWSURFACE to BMP file

do i ask too much?

Share this post


Link to post
Share on other sites
Whoa. That''s news to me
In any case, I''m not sure what you''d want to save it as 16 bits for anyway... after all, there is no proper standard for 16 bit formats (although with Direct3D there''s a very limited number of possibilities, fortunately)


- JQ
Full Speed Games. Period.

Share this post


Link to post
Share on other sites
quote:
Original post by JonnyQuest
In any case, I''m not sure what you''d want to save it as 16 bits for anyway... after all, there is no proper standard for 16 bit formats (although with Direct3D there''s a very limited number of possibilities, fortunately)
That''s why nobody supports it. But it''s a valid bit depth for a bitmap.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
There are 1,4,8,16,24, and 32 bit bitmaps.
1,4, and 8 use palettes. The palette entires are stored in 32 bit values. Information on the bitmap format is available all over the net. You''ll have to learn from it, to get your program working properly. I''m surprised you don''t have a procedure to simply call for saving files like this.

For 16-bit bitmaps, each pixel is stored in 16 bits. surprising, ah?

A 16-bit colour uses 5 bits for each prime colour intensity instead of 8 bits(full bytes) for each.

24-bit to 16-bit conversion code is available elsewhere on this site.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Anonymous Poster
For 16-bit bitmaps, each pixel is stored in 16 bits. surprising, ah?

A 16-bit colour uses 5 bits for each prime colour intensity instead of 8 bits(full bytes) for each.



Lets see here 5 bits for red, 5 bits for blue, 5 bits for green hey that''s 15 bits! Now that I''ve finished my sarchastic reply to this post I''ll actually be a bit useful. 16bit bitmaps are usually stored on disk as 5-6-5 images, because it''s easier to chop off that extra bit of green data than to put it in. Although there are very few programs that will actually save out a 16bit image, there are at least one or two that can. Debabelizer comes to mind. In any case if a bitmap is stored in 16bit format most likely it will not be recognised as a valid bitmap by any of the applications you might use to create such a bitmap. Which is why most of the time all bitmaps are saved out as 24bit then scaled down to 16bit when your game starts up. Sure it''s an extra task and it does take up a tad more space but the benefit of being able to easily modify the image should it not look right usually out weighs that cost.


Share this post


Link to post
Share on other sites