BITMAPINFOHEADER
really is 40 bytes in size. Keep in mind that a bitmap is represented by a BITMAPINFO
struct, not a BITMAPINFOHEADER
struct by itself. BITMAPINFO
contains an optional RGBQUAD
color palette immediately after the BITMAPINFOHEADER
struct.
1700x2200 would be 3740000 pixels, which would take up 467500 bytes as the bitmap is using 1-bit pixels, ie it is a monochrome bitmap. Your bitmap has an extra 8 bytes in between the header and pixel data, with is consistent with a monochrome bitmap as the color palette would contain 2 RGBQUAD
values. You have to take the BITMAPINFOHEADER::biBitCount
field into account, as it tells you how many bits are actually used per pixel and how the color palette is used.
The additional bytes are accounted for by each scanline being padded at the end to align on DWORD
boundaries. biSizeImage
is calculated in this situation as:
biWidth = 1700
biCount = 1
biHeight = 2200
biSizeImage = ((((((biWidth * biCount) + 31) / 32) * 32) / 8) * biHeight) = 475200