Search code examples
bmpimage-compression

Why is the actual size of the bmp file different from what I have calculated?


512x512 bmp image should have 512x512x3(RGB)x8(bit for int 0~255) = 6291456(bit) = around 6000KB. But actually it takes only 768.1KB. So what went wrong? Thanks for helping


Solution

  • Your mistake is confusing bits and bytes.

    6291456 bits is 786432 bytes or 768KiB.

    Add to that a few bytes for headers and alignment and you'll reach 768.1KiB easily.