18.2. Understanding Image Representation

Understanding images requires understanding a set of abstractions:

  1. Images are made up of little pixels (objects of the Pixel class), laid out on an (x,y) grid.

  2. Each pixel contains a red value, a green value, and a blue value.

  3. Each color value is actually a number between 0 and 255.

  4. If a pixel has red=0, green=0, and blue=0 then the color is black since this is an absence of any color of light.

  5. If a pixel as red=255, green=255, and blue=255 then the color is white. Try tilting the bottom of a cd in white light to see the colors in the light.

A grid with horizontal (x) and vertical (y) dimensions

Figure: A grid with horizontal (x) and vertical (y) dimensions

There are some excellent CS Unplugged activities for understanding image and color representation.

Before you keep reading...

Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.

You have attempted 1 of 3 activities on this page