Firstly, you need to know that all computers store everything in binary which consists of only 2 numbers: 1 and 0
Let's have a look at an image here. Each of these little boxes (squares), which are called pixels and are superimposed on top of the smiley face can be converted into a sequence of ones and zeros
if 1 represented white and 0 represented black then the code for it would look like this:111111111111111111110111011111111111111111111110111011etc
Bit is the binary digit. It can hold only one of two values: 0 or 1, corresponding to the electrical values of off or on, respectively. It is also used to describe the amount of colors able to be used. The less bits, the less colors able to use.
There are also different types of image generators. The one we are talking about is Bitmap. This is how images are organized as a grid of pixels and each pixel is stored as a binary number and represents a specific colorThe word bitmap comes from binary map.
Did you know 1 bit per pixel allows 2 values(1 and 0) whereas 8 bit per pixel allows for 256 colours and more.
This table shows the different amount of colors we could use in each bit
This graph represents 24 bits colors and their binary number