5. Encode an Emoji
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.