How Images are Stored

When you see an image on a computer screen, what you’re really seeing is a grid of individual pixels. Each of those pixels has a corresponding red, green, and blue value, since we can make any color that a human can see by adding together just those three colors of light. If you were to zoom in far enough on your computer screen, you could see the grid of pixels, as well as these three colors

A close up of a computer screen displaying a smiling emoji

A close-up of a computer screen. Hurts your eyes, doesn’t it? Mine too.

In addition to those three colors, some pictures also have a fourth value called an “alpha” channel. This affects how transparent a certain pixel is, this comes into play when you have one image sitting on top of something else. It is useful in many scenarios, but the filters we build today are strictly going to change the color of the image, without touching the alpha channel. Hence why we included the line img.convert(“RGB”) in the previous section. It essentially forces our image to cut out the alpha channel when we manipulate it.