0

The CS50 course by Edx that I am pursuing has this statement in their Week 4 practice set:

A 24-bit BMP file, then, is essentially just a sequence of bits, (almost) every 24 of which happen to represent some pixel’s color.

If I understand correctly,

101010101110101010101011 will represent a color.

How the length and breadth of 1 pixel defined. It is easy to visualize 1 cm, 1 meter. How to visualize 1 pixel?

Suppose this is the image:

enter image description here

How will the bitmap code look like? Any tool to generate the binary code after uploading the image?

1 Answers1

2

If you think about the sample image provided as a grid of colored squares then the first pixel is the most upper left square and the sequence of bits represents that pixel color.
For each pixel you have 24 bits, assuming the color is expressed as RGB, then you have 8 bits per color channel. So 1 byte per color (from 0 to 255 in decimals).

10101010|11101010|10101011
 R:170    G:234     B:171