ICT & Computing‎ > ‎

Bitmap Graphics

Bitmap graphics are when one or more binary bits are 'mapped' onto the screen as coloured dots. 

The simplest form is using 0 to represent black and 1 for white, so 1010101 would give 7 pixels (screen dots, from 'picture elements') in a row, 4 of them white and 3 of them black.

Since a single binary digit can only be 0 or 1, it can only represent one of two colours, black or white. To represent more than 2 colours, we need to 'join up' more binary bits to represent a wider range of colours. Four colours can be represented with just 2 binary bits: 00=black, 01=red, 10=yellow, 11=white (or whichever 4 colours you choose, but no more than 4).

With 3 digits there are 8 possible values: 000, 001, 010, 011, 100, 101, 110 & 111. These can then be 'mapped' to 8 possible colours. Since colours are created on-screen by emissions of red, green and blue light (either from CRT guns or LEDs in modern screens) the binary values can be mapped directly onto the 3 colour outputs, RGB, with the first bit being red, the second bit green and third bit blue.

Modern computer systems allocated 8 binary bits to each red, green and blue value, enabling each to vary from 0 (no red) to 255 (max red) and everything in between. This gives over 16 million possible colours (256*256*256 = 16,777,216). At very high pixel densities, images using such 'deep' colour palettes become indistinguishable from reality.
1-bit Challenge: Edit this code to change the 'B' into an 'A'
2-bit Challenge: Edit this code to change the character's eyes to red.
Bonus Challenge: Can you make his jumper blue?
3-bit Challenge: Edit this code to change this guard's spear into a flaming torch