Every digital screen is made up of tiny squares called pixels. These pixels can be any color. Together, they make the images you see on your device! Look at the image to the right. It’s a drawing of a house zoomed way in so that you can see the pixels.

A computer can’t “see” images. It needs to know the color and position of each pixel to show a picture. One way to describe an image to a computer is to list the color of each pixel in order, like this:

To make this easier, it helps to notice patterns in the pixels. For example, you could group pixels that are the same color together. The first row would read: 2 white, 1 black, 2 white. To make it even shorter, say 2, 1, 2.

This is a way of encoding a black and white image as numbers. Each number represents a group of pixels. Listing numbers takes up less space and time than listing every pixel color. Using groups saves space when large areas of an image are the same color. To turn that encoding into an image, read each row. Starting with white, fill in the pixels. Every time you see a new number, switch color.

Instructions

Using the grids on pages 4 and 5 of your booklet:

  1. Start at the top-left corner. The first number in the encoding is the number of white pixels to start (even if it’s 0).
  2. Go to the next number in the encoding and color in that many black pixels.
  3. Keep going through the encoding, switching between black and white pixels.
  4. When you get to the end of a row, move to the next row down. Repeat until your image is done!
namespaces/google.engedu.csfirst/contents/Activity-172668902339618159658427959685075904449en