## How bitmap images are stored

so let's begin to think now about how

images are saved on a computer here's a

very simple image here it's 32 pixels by

32 pixels well however think about what

that means a minute if i zoom in on it

this is about as far as it can go this

is just using paint that's very

straightforward program button the

gridlines on what this then shows us is

all the individual pixels that make up

this image a pixel is basically its

smallest area of the image which can be

colored in and as I said this one is 32

pixels wide and 32 pixels tall as we've

already seen when considering how

computers store numbers and letters the

answer is they store them as binary

numbers so zeros and ones and it's no

different with pictures in this picture

is fairly straightforward we could

represent all the white squares as zeros

and all the black squares as ones and

that could then be saved in a file in on

the computer's hard disk if we pick a

slightly different picture now and have

one which is got a little bit of color

to it

in this situation it's a little more

tricky we've got white and black as

performant we've got two other colors

we've got four colors in total in this

situation we can't just have one bit to

represent the color so we're going to

need more bits in this case we've got

four colors and we can therefore use two

bits for each pixel to store the color

it might be that zero zero stores the

white one one maybe stores the black and

then we could assign zero one for the

yellow and one zero for a red and so

this picture could be then stored each

pixel being represented by two bits

let's finish up them by replacing some

of these pixels with their binary

representation the Reds one zero is the

yellow zero ones and so on and if we

remove the image from the background

we're left with the contents of the file