BMP structure

Started by
10 comments, last by Craazer 21 years, 7 months ago
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.
Advertisement
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.


This topic is closed to new replies.

Advertisement