How many bytes does a tiny school logo need, and what happens if you make it wider?
Your school in Leeds needs a tiny logo for its website. The logo is twenty pixels wide and ten pixels high. How many bytes do its pixels take up, and what happens if you make the logo twice as wide?
Each square in this bitmap is a pixel. Use zero for white and one for black. Read from left to right: white, black, white gives zero, one, zero. Now reverse the process with a new code. One, zero, zero gives black, white, white.
Multiply the width by the height to count all the pixels. A bitmap stores one colour code per pixel. The number of bits in each code is the colour depth. Multiply the pixel count by the colour depth to get the raw pixel data size in bits.
A bitmap is six pixels wide and four pixels high. Each pixel’s code is two bits long. Which calculation gives the size of the pixel data in bits? Pick one.
The logo has ten rows of twenty pixels, so that’s two hundred pixels. Each code takes four bits. Two hundred times four gives eight hundred bits. There are eight bits in a byte, so divide eight hundred by eight to get one hundred bytes.
Your turn. A different logo is sixteen pixels wide and six pixels high, with four bits per pixel. How many bytes does its pixel data take up? Pick an answer.
At twenty by ten and four bits per pixel, the logo uses eight hundred bits. At forty by ten, you have twice as many pixels, giving sixteen hundred bits. Start again at twenty by ten and use eight bits per pixel. Each code is twice as long, so you also get sixteen hundred bits.
If you add twenty and ten, you get thirty. Multiplying that by four gives the wrong answer of one hundred and twenty bits. The grid has ten rows with twenty pixels in each, so you multiply to get two hundred pixels. At four bits per pixel, that gives eight hundred bits.
A Paper Two question might ask you to calculate the pixel data size in bytes. Multiply twelve by eight by two to get one hundred and ninety-two bits. If the question asks for bits, stop there. For bytes, show the division by eight and give your answer as twenty-four bytes.