i\'m new to this field ,and i get confused between some terms!
bisizeimage, bisize and bfsize!
please i need a s
bfSize is the full file size of the bitmap image the file size of a bitmap image is made up of two parts:
Therefore, we have the following structure
bfSize = bfOffBits + biSizeImage
Futhermore, bfOffBits (the header part) can be further broken up into
Therefore, it can be also written as
bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + biSizeImage
Since (by today's BMP definition) the size of BITMAPFILEHEADER is exactly 14 bytes and the size of BITMAPINFOHEADER is exactly 40 bytes this could also be written as
bfSize = 14 + 40 + biSizeImage
or
bfSize = 54 + biSizeImage
However, this would be bad practice, as hardcoding 'magic numbers' is generally frowned upon.
But let's look at biSizeImage. The file size of the image itself is made up, generally speaking, by the color depth * width * height. The color depth in a 24-bit BMP is 3 bytes per pixel (0-255 values for blue, green, red, respectively) — a so called RGB triple. Additional info for experts: the values for the three colors are saved in the order of blue, green, red — search the keyword LittleEndianness for further info on that topic. The BMP standard also adds 0's as padding if the width of the image is not divisble by 4 bytes.
Slightly confusingly, as others have pointed out, you now have to multiply the size in pixels with the depth in bytes. Therefore, we have
biSizeImage = (biWidth * sizeof(RGBTRIPLE) + padding) * abs(biHeight)
which will give you the final size in bytes of the image.
So, to conclude:
A nice overview of the structure of a BMP can be found here
Edit: Added correction (thanks to @MotherBrain)