How to calculate bitmap file size?

19,629
  1. Assuming you mean in-memory requirements, the minimum amount of memory needed would be 50 * 50 * 3 (width * height * numComponents), or 7500 bytes for RGB. However, it might be faster to pad each scanline, for example to an even number of 32 bit entities, making the the actual requirement higher. Also, it may be better for the graphics card to have the values in ARGB format, in which case it would be 50 * 50 * 4 (= 10000).

  2. It depends on the compression used in the BMP file, but if there's no compression I think the minimum would 54 + 50 * 50 * 4, or 10054 bytes, as BMPs are typically stored as 32 bits per pixel. Note that BMP files have different sizes of valid headers, can store indexed (palette) images, and also 16 bit images so the above will hold only for normal, uncompressed 32 bit/pixel "true color" BMPs.

  3. Read the specification, and you should understand how it works. To see the contents of an actual file sample, open it in a hex viewer/editor or other tool that allows you to see the binary contents of the file.

  4. Hexadecimal is just a different representation of the values, as opposed to decimal or octal. If the byte value is 255 decimal, it will be FF in hexadecimal, for example.

Share:
19,629
assal0le
Author by

assal0le

Updated on June 04, 2022

Comments

  • assal0le
    assal0le about 2 years
    1. How to find size in byte of 50 x 50 RGB color image?
    2. If the above image saved in BMP file with 54 bytes of header size, what is the total size of that BMP file?
    3. How to know the content of every bytes in BMP file?
    4. And how to know the hexadecimal value of it?