Lesson 8: Color Images

Overview

This is a second opportunity for students to interact with the Pixelation Widget, but this time they will work with color pixels. Students start off learning that each pixel uses red, green, and blue lights that can be turned on or off using bits. They will create more color variants using an increasing amount of bits per pixel, and apply their learning by approximating an analog color image using the widget.

Purpose

This lesson continues the story of how bits are used to represent digital images. Much like in the last lesson, students will use the Pixelation Widget to attempt to make digital approximations of analog images, this time in color. These images are produced using layers of abstraction, with each layer relying on the other to perform its process.

Students will begin to realize that analog color images have values that change smoothly and subtly, while digital images do not. The number of digital colors is also limited by the number of bits per pixel, whereas analog colors are unlimited.

Agenda

Lesson Modifications

Warm Up (5 mins)

Activity (35 mins)

Wrap Up (5 mins)

View on Code Studio

Objectives

Students will be able to:

  • Explain how bits can be used to represent the individual pixels of a color image
  • Explain how digital data is used to approximate real-world analog data

Preparation

Links

Heads Up! Please make a copy of any documents you plan to share with students.

For the Teachers

For the Students

Teaching Guide

Lesson Modifications

Attention, teachers! If you are teaching virtually or in a socially-distanced classroom, please read the full lesson plan below, then click here to access the modifications.

Warm Up (5 mins)

Discussion Goal

Goal: Start with having students name shades, but quickly transition to how many they think exist altogether. The goal here is to have students begin to wonder if computers can represent all of the vast number of shades of colors in our world. This should be a quick discussion. You can move on as soon as this point is made.

Prompt: How many different shades of the color blue can you name? How many do you think there are in total?

Discuss: Have students share with a partner. Then, invite a few students to share what their partner said.

Remarks

Great job! We came up with many different shades of blue. As we continue today, let’s keep thinking about whether there is a limit to the number of shades of blue there are in the world, and whether a computer can display all of those shades.

Activity (35 mins)

Teaching Tip

In Levels 3, 5, and 6: The directions are written in so that students who are color-blind do not need to be able to distinguish between colors to be able to complete the task. That being said, students who are color-blind may not be able to visually check their work in the same way as other students. You can suggest that students who are color-blind ask a partner to check their work at the end of each of these levels.

In Level 8: It is recommended that students who are color-blind do the black and white gradient image which is the option in the lower right hand corner of the pop-up in Level 8, which looks like this:

Note: This lesson includes color images in a number of places. See the teaching tip on the right for some additional guidance that may be useful when supporting students who are color-blind.

Teaching Tip

Each section of levels begins with a reference level before moving on to a widget level. Make sure the students carefully read the reference levels.

Reference Tabs: Encourage students to keep the reference levels open in a second tab as they work with the widget. They can do this by hovering over the circle of the level at the top of the screen, then right click and choose “open in a new tab”.

Counting in Binary: Students who are struggling with the binary sequences should be encouraged to take out their Flippy-Do to help them count, especially on Challenge 3 and 4.

Sampling Support: Students may become frustrated if they feel they cannot match the analog images. Reassure them this is fine. Remind them about the discussion from the warm up and ask if it’s possible that digital images ever look exactly like analog images. You may also ask the students if their representation would be improved if they use more bits per pixel.

Remarks

Today, we’re going to see how this relationship between analog and digital plays out in the world of color. You’re going to get a chance to play with the pixelation widget again, but this time you’ll be using it to make your own special color blends, or gradients. After each level, I want you to check your work with your partner.

Group: Students will work individually in Code Studio, checking each level with a partner before proceeding.

Teaching Tip

In the video on Level 2, metadata (data that explains other data) is explained - these are the pixels we now see at the beginning of the work space which represent the height, width, and bits of pixel of the image. These can be changed using the sliders.

Levels 2-3: Students should type in a unique 3-bit code for each pixel, producing 8 different colors.

Level 4-5 Students make four different shades of blue, followed by four different shades of green, using 6 bits per pixel. The red row is already done for them.

Level 6: This time, students use 9 bits per pixel. They will make 8 different shades of green and 8 different shades of blue (the red row is done for them).

Do This: Regroup the class for levels 7-8 and direct everyone to the images on the slides. Levels 7-8: Level 7 contains samples of various color gradients. Students should choose a section from one of the images, try to take a sampling, and attempt to reproduce the sample gradient as best they can on Level 8.

Wrap Up (5 mins)

Remarks

So as we saw in the last two lessons, the digital versions of images we produce differ from the original analog images. Analog images change smoothly and continuously. With digital images, we are limited by the number of bits we use. Even if we use a lot of bits, we can still only represent a finite number of colors, and gradual color changes can only happen discretely through a finite set of pixels.

Discussion Goal

Goal: Students should understand how sampling, pixels, and binary work together to make a digital approximation of an analog image. They should also understand that while analog images are able to change color values smoothly and continuously, digital images rely on pixels to change from a fixed number of color values discretely using squares of equal size.

Prompt: How is an image represented on a computer?

Journal: Students record the layers of abstraction in their journals. Click through the animation.

Remarks

We can see that a digital image is made up of several layers that work together to represent the analog image. This is an example of abstraction because we don’t always look at the details of what’s going on in all of these layers, but they are working behind the scenes. Let’s watch a video of how this works.

Display: How Computers Work Video


Assessment: Check For Understanding

Check For Understanding Question(s) and solutions can be found in each lesson on Code Studio. These questions can be used for an exit ticket.

Question: Which statement about analog and digital images is true?

Question: Describe how the process of sampling, RGB pixels, and binary sequences work together to display a digital color image.

  • Check Your Understanding
  • 2
  • 3
  • (click tabs to see student view)
View on Code Studio

Student Instructions

View on Code Studio

Student Instructions

In 50 words or less, describe the concept of a number system.

Why are rules required for a number system to be useful?

Standards Alignment

View full course alignment

CSTA K-12 Computer Science Standards (2017)

CS - Computing Systems
  • 3A-CS-02 - Compare levels of abstraction and interactions between application software, system software and hardware layers.
DA - Data & Analysis
  • 2-DA-07 - Represent data using multiple encoding schemes.
  • 3A-DA-09 - Translate between different bit representations of real-world phenomena, such as characters, numbers, and images.

CSP2021

DAT-1 - The way that the computer represents data is different from the way that the data are interpreted and displayed for the user
DAT-1.A - Explain how data can be represented using bits.
  • DAT-1.A.9 - The use of digital data to approximate real-world analog data is an example of abstraction.