default bpp for bitmap files in Windows

Category: visual studio vclanguage


jyf3jyf3 on Fri, 12 May 2017 19:41:53

what is default bpp for bitmap files in Windows, if any?


Castorix31 on Fri, 12 May 2017 20:44:55

From MSDN :


A bitmap size is related to the type of image it contains. Bitmap images can be either monochrome or color. In an image, each pixel corresponds to one or more bits in a bitmap. Monochrome images have a ratio of 1 bit per pixel (bpp). Color imaging is more complex. The number of colors that can be displayed by a bitmap is equal to two raised to the number of bits per pixel. Thus, a 256-color bitmap requires 8 bpp (2^8 = 256).


Darran Rowe on Sat, 13 May 2017 13:39:46

To give some specifics, bitmaps don't have a "default".

You will always have to declare in the bitmap information what the pixel format is. For example, if you look at the BITMAPV5HEADER structure, then you will see there that there is the bV5BitCount field. The only option that it supports are in that documentation, and none of them is default.

It is rare to find bitmaps in anything but 24 or 32 bits per pixel these days, so if you want to assume then go for one of these. But it would be best to always check.