bitmap puzzle

  • ianking

    Can anyone tell me why a 10 X 10 monochrome bmp file is 102 bytes in size. (I’m writing a unit on standard file formats) A txt file 15 characters long takes up 15 bytes exactly which makes sense. A 100 X 100 monochrom bitmap file is 1.62Kb instead of 1.22Kb which is better but not right. (or should I be avoiding using mspaint?)

    Mark J Tennant

    I assume it will be due to additional header information that’s stored with the bitmap image.



    Yes Ian,

    14 bytes for the Bitmap header of the image.
    40 bytes for the DIB header (I’m assuming your using Windows XP or later versions of windows – BITMAPINFOHEADER is probably used).
    Pixel array would be next (its padded out to at least 4 bytes per row of pixels)
    10 rows of pixels, each row padded to 4 bytes is
    40 bytes for the image data
    So 94 bytes so far
    The last 8 bytes is for the colour palette as 4 bytes are used to define black and 4 bytes used to define white.

    14 + 40 + 40 + 8 = 102 bytes

    Hope that helps,


    P.S. You can read Wikipedia’s excellent breakdown of the file format here:


    Many thanks Charlie. A truly comprehensive explanation.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.