Coding in Color: AP Computer Science Students Turn Pixels into Possibilities
October 5, 2026
Students in Mr. Wagner’s AP Computer Science Principles class are discovering how programming can transform the way we see and interact with digital images.
As part of their study of functions in Python, students are learning how to write and use functions to manipulate individual pixels within an image. By changing the color values of individual pixels, students can create entirely new images and designs using code.
The key to the activity is understanding RGB values, which represent the amounts of red, green, and blue that make up each color on a digital screen. By adjusting these three values, students can change the color of individual pixels and, when applied across an entire image, dramatically transform its appearance.
For example, students can use Python functions to modify pixels and turn an existing image into a smiley face, create a new pattern, or develop another unique design. What may look like a simple image on a screen becomes a hands-on programming challenge as students determine how their code will change thousands of individual pixels.
This engaging activity gives students an opportunity to apply important computer science concepts, including functions, variables, problem-solving, and computational thinking, while also encouraging creativity and experimentation. Students can immediately see the results of their code, test different approaches, make adjustments, and learn from the outcomes.
Through experiences like this, AP Computer Science Principles students are seeing firsthand how programming can be used not only to solve problems, but also to create, design, and bring ideas to life.