Lesson 3: Images
Copyright (c) 1998, C. Heeren, T. Magliery, and L. Pitt. This lesson and supporting materials may be copied for nonprofit educational use only.


Recall from Lesson 1: Binary Numbers that all information in a computer is stored as sequences of 0s and 1s. We talked about the way this works for numbers, but how does it work for pictures?! 


  1. Several pictures from a newspaper. 
  2. "I am made of pixels" demonstration overhead.
  3. Gray images of heart and helmet, with different grid sizes (one copy per student), and crayons.
  4. Overhead demonstration gray image grid. 
  5. Simple run length coding image (Block Art Demo) on overhead(s), and Block Art worksheets easy for younger kids, or harder for older kids. One copy per student.
  6. White grids for large image, approximately 1000 black squares (1.375in x 1.375in), and plenty of glue sticks. (Or, borrow our re-usable set of grids and squares instead).
  7. Run length codes for Lincoln and Edison large image sections.

Lesson Plan:

  1. Explain the motivation for the lesson. The question is, "how do we convert any black and white picture into a sequence of 0s and 1s?" 
  2. Distribute news photos. Tell kids to look closely and notice that the pictures are really small dots. Another fun thing to do at this point in the lesson is to have a fax arrive for the students to look at. Also, ask kids if they ever sit so close to the TV that they can see that the picture is a bunch of dots. 
  3. Explain that the first task is to figure out how to break the pictures into small pieces. This process is called "digitizing". For us the small pieces will be squares. On a computer these small pieces are called pixels, short for picture elements. 
  4. If you have a computer, use a drawing or painting program to create an image (or use an existing image or letter), and then enlarge the image a lot. We like to enlarge the phrase "I am made of pixels." The pixels become apparent as jagged pieces of the object.  If you don't have a computer, use our handout to demonstrate the point.
  5. Distribute one gray image grid handout to each student (not all students will receive the same image or grid). There are two different images and four or five different grid sizes. It's most important that you have a variety of grid sizes and images to examine, so make sure all the different types of images are handed out. 
  6. On a gray image overhead (heart or helmet) demonstrate the coloring scheme: color a grid square completely if over half of it is filled by the image, otherwise leave it blank. (It is not important to judge "half-covered" exactly - don't let them fret over this. Of course, this could lead into a lesson on area estimation...)
  7. Let students fill in their grid using this scheme. 
  8. Have students get together with other students who have drawn their same picture on the same and different sized grids to compare results. Large grids may not have any squares colored, and will certainly not look like the original image. As grid size decreases, image will become clearer. Kids should discover this. 
  9. Choose one of the images to demonstrate this to the class. Spend a few minutes in general discussion of the images. Students may need to gather around closely in order to see the images clearly.
  10. As the kids notice that the picture gets better and better when grid sizes get smaller, ask them why we don't just make the grid as tiny as possible, thereby making the image very clear. Someone may suggest that it's because we have to store many many squares.  If no one suggests this, prompt them by saying something like, "What if each square costs $1 to store?"   Have them compute the number of squares they have to store for a given grid size. Notice that if you double the number of squares on each side, the total number of squares is multiplied by 4. Example: 10 by 10 grid gives 100 squares, and 20 by 20 grid gives 400 squares. 
  11. Another point of discussion:  Notice that parts of some images have lots of detail, and other parts are just large blocks of color.  In practice the number of squares is reduced by using small squares where lots of detail occurs, and large squares where there isn't much detail. 
  12. Conclusion of this section:  We call the number of squares used in an image the image's "resolution." High resolution results in clear detailed images, and low resolution may result in cloudy or jagged images, but transmission of the images will be fast. Inexpensive ink-jet printers often use a resolution of between 300 and 600 "dpi" (dots per inch). For example, a square inch of solid black produced by a 600 dpi printer would contain 600 wide by 600 tall (= 360,000) tiny ink dots! Web documents use 72 dpi.

  13. Next ask the kids how we can store pictures like these using 0s and 1s. Someone will respond "black squares are 1, white squares are 0," or some such. 
  14. Place one of the gray images drawn with a small grid on the overhead, and talk about how that image would be transmitted over a modem. Start at the upper left corner of the image and read left to right: "0, 0, 0, 0, 0, ..." Ask if the kids can think of a better way of doing this. They should recommend something like "Yo! Here come 100 0s!"  If they don't, then just tell them.
  15. Show the students how this idea generalizes. Select a line from the gray image grid overhead to encode. Begin by writing down the number of consecutive white squares. Then write down the number of consecutive black squares, and so on until the whole line has been coded. Notice that lines beginning with a black square have a zero at the beginning of the code to indicate that there are no white squares at the beginning of the line. This process is called "run length coding".
  16. Someone will probably point out that this technique uses other numbers besides 0 and 1. Ask the students how to solve this. They should say that the decimal numbers can be converted to binary! (If no one brings this up, be sure to tell them.)
  17. Next, using the Block Art Demo overhead, demonstrate encoding an entire (simple) object. Discuss the fact that fewer numbers need to be transmitted this way. Also demonstrate decoding a simple picture from the same overhead. You may want to have one of the students come to the overhead to help. This can also be done on the chalkboard, but it can be a bit of a mess.
  18. This is the fun part. Tell the students that they will all cooperate to make a huge picture. Hand out the white grid sheets, plenty of little squares, the run length coding cards, and several glue sticks. Most people will probably have two cards to complete, but some of the cards are super simple (there are even 6 blank ones) so this is ok. Have the students orient their grids vertically and fill in the squares indicated by the run length code.  Then, on a giant 7x7 grid on the floor, have the students lay out their cards where they belong.  The students can do all the shuffling and arranging as they complete their cards.  Each coding instruction card is numbered to indicate its position in the large grid.  Number (3,2) means row 3, column 2.  What is the image?
  19. Hand out age appropriate Block Art worksheet, and let the kids discover the images. 


Suppose you have an image with a block of 1000 white pixels. You could either send this white block using 1000 bits of 0, or you could send the number 1000 followed by a special separating symbol, and then a 0 in a total of 12 characters. This is a remarkable difference! Saving space using techniques like this is called data compression, and it's crucial to the viability of working with images on computers. As an example, transmission of images over the internet would be impossible without significant compression. Think about the amount of data necessary to view a movie on the internet!


For the first part of this lesson, try to observe the level of participation of each student.  All students should be able to complete the gray image grid sheets, so their value as an assessment tool is limited. 

An appropriate assessment tool for the second part of the lesson would ask the students to compare the efficiency (in terms of number of bits required) of run length coding (as shown in the Block Art examples) versus explicit bit by bit transmission.  You can do this as a supplement to the Block Art worksheet by having the students do the analysis on the back of the sheet.  There is no "right" answer to this challenge. Instead, look for the quality of their argument.  This task is probably not appropriate for younger students.  For them it is enough to assess their understanding of image encoding using the simple Block Art worksheet.


If you have time you may want to examine what happens if you use one of the small grid images as the original image. When a larger grid is filled in from this image, it is exactly the same as the large grid made from the smooth picture. Similarly, try using one of the large grid images as the original image, and fill in a smaller grid. The new image is exactly the same as the original large grid image. The lesson here is that once information is lost it cannot be recaptured, i.e. once the image becomes unrefined, it cannot be re-refined. 

Again, if you have time, it's fun to have the kids draw their own images on grid paper and create the corresponding run length code. They can pass the coded image to friends to decode. 

In practice there is usually a limit to the maximum length of a run of pixels because the length is being represented as a binary number. Ask the students how they would represent a run of twelve black pixels if they could only use numbers up to seven. Answer: 7 black, 0 white, and 5 more black, is one option. 

Older kids should try to come up with compression routines of their own, and compare them to run length coding. Do their codes work particularly well on specific kinds of patterns? What kind of pattern is particularly bad for run length coding? 

Have the students research other existing techniques of data compression. A particularly interesting one is quad-tree representation, which is based on looking for blocks of pixels all the same color (rather than lines of pixels). 

Ask the students to calculate the amount of data contained in a half hour of television programming if their television has 1000 bits per line, 400 lines per inch, and the program is shown in 30 frames per second. Discuss the way in which compression techniques might work for video. The crux of the explanation is that the images don't change much from frame to frame, so if you can think of a way of communicating only the changes between frames, you'll probably save a lot of data. 

Students may ask how this works for colored pictures. Ask them for ideas about how colors and other attributes can be represented. If you have a computer you can see how colors are specified by setting colors on the color wheel using hue, saturation, etc. or, alternatively, using RGB values (Red, Green, Blue). 

If you have access to computers, get a jpeg-compressed black/white image, and see how much space it takes in Kilobytes. (A Kilobyte is 1024 bytes, or 1024 x 8 bits). When uncompressed, see how many bits it takes (by multiplying height x width in pixels), and compare. 


  • NCTM K-4:  1, 2, 3, 4, 7, 8, 9.
  • NCTM 5-8:  1, 2, 3, 4, 7, 8.
  • NCTM 9-12:  1, 2, 3, 4, 6, 12.


  • Problem solving / reasoning / communication / connections
  • Counting
  • Encoding and decoding practice
  • Spatial sense
  • Art

Copyright (c) 1998, C. Heeren, T. Magliery, and L. Pitt. This lesson and supporting materials may be copied for nonprofit educational use only.