i'm new to this field ,and i get confused between some terms!
bisizeimage, bisize and bfsize!
please i need a simple definitions for each one, and if there is equations to calculate them ?
bisizeimage bisize bfsize bitmapinfoheader bitmapfileheader
edited : ("answered by friend")
biSize > The number of bytes required by the structure. (what is the structure exactly ?)
The structure is the struct BITMAPINFOHEADER. That is a fixed value.
biSizeImage > The size, in bytes, of the image. bfSize > The size, in bytes, of the bitmap file. (what is the difference between image & bitmap file ?)
biSizeImage is the whole image size, bfSize is the same, but you have to add the size of the 2 header files.
@Roman Abashin's answer has a slight but important error. biSize is not the combined size of both headers.
biSize is the size of the BITMAPINFOHEADER only. It is 40 bytes.
biSize = 40
The combined size of both headers is actually bfOffBits (you can think of the "Off" as referring to the offset of the actual bitmap from the beginning of the headers - remember, the bitmap comes straight after the headers).
bfOffBits = 54
Therefore all the following are correct formulas for bfSize:
bfSize = biSizeImage + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)
bfSize = biSizeImage + sizeof(BITMAPFILEHEADER) + biSize
bfSize = biSizeImage + 14 + 40
bfSize = biSizeImage + 54
bfSize = biSizeImage + bfOffbits
And @Roman Abashin's formula for biSizeImage, the size of the actual bitmap, is correct for a 24-bit bitmap.
Confusingly, biSize, bfOffBits, bfSize and biSizeImage are all in units of bytes, whereas biWidth and biHeight are in units of pixels. The number of bytes per pixel is defined in the biBitCount part of the header. It is 3 bytes (or 24 bits) for a 24-bit bitmap.
Note that bfOffBits's units are in bytes and biBitCount's units are in bits.
More detail can be found on Microsoft's pages:
Info on BITMAPFILEHEADER
Info on BITMAPINFOHEADER
Edit: I added some annotations to the bitmap overview below to clarify things even more Edit: Changed biSizeImage + 24 (etc etc) to + 14.
bfSize = biSizeImage + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER)
bfSize = biSizeImage + 54
// since BITMAPFILEHEADER = 40 and BITMAPINFOHEADER = 14
biSizeImage = (biWidth * sizeof(RGBTRIPLE) + padding) * abs(biHeight)
One tiny typo, in @Shock451 answer. According to: https://en.wikipedia.org/wiki/BMP_file_format the values of BITMAPFILEHEADER and BITMAPINFOHEADER are swapped.
there Should be:
// since BITMAPFILEHEADER = 14 and BITMAPINFOHEADER = 40
not:
// since BITMAPFILEHEADER = 40 and BITMAPINFOHEADER = 14
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With