00 00 00 00 ff ff ff 00
These bytes are a color palette. Since your bits per pixel are set to 1, there can only be two colors in the palette. The first color is black ( 00 00 00 00 ), and the second is white ( ff ff ff 00 ). The last byte of each color is just a filler and always has the value 00 .
c0 00 00 00 00 00 00 00
This is the actual pixel data. Each row of pixels should be filled to the nearest 4 bytes that may contain data. So, here the first row is the bottom row of pixels, and the second row is the top row of pixels (since the BMP pixel order is ascending). Since we use 1 bit per pixel, we need to look at it at the byte level. In particular, the first row of pixels is defined as follows:
1100 0000 0000 0000 0000 0000 0000 0000
Since we have only two pixels in each row of pixels and only 1 bit per pixel, only the first two bits matter. In this case, 11 indicates that the first two pixels are the second color in the palette ( 1 ). Now for the second line we have:
0000 0000 0000 0000 0000 0000 0000 0000
and again we only need to look at the first two pixels, 00 . This means that the following pixels are the first color in the ( 0 ) palette.
source share