Chapter 10. Bitmaps and Pixels

In this chapter, you’ll learn about video and images and how your computer processes them, and you’ll learn about how to display them, manipulate them, and save them to files. Why are we talking about video and images together? Well, both video and photos are bitmaps comprised of pixels. A pixel is the color data that will be displayed at one physical pixel in your computer monitor. A bitmap is an array of pixel data.

Video is several different things with quite distinct meanings: it is light from a projector or screen, it is a series of pixels, it is a representation of what was happening somewhere, or it is a constructed image. Another way to phrase this is that you can also think of video as being both file format and medium. A video can be something on a computer screen that someone is looking at, it can be data, it can be documentation, it can be a surveillance view onto a real place, it can be an abstraction, or it can be something fictional. It is always two or more of these at once because when you’re dealing with video on a computer, and especially when you’re dealing with that video in code, the video is always a piece of data. It is always a stream of color information that is reassembled into frames by a video player application and then displayed on the screen. Video is also something else as well, because it is a screen, a display, or perhaps an image. That screen need not be a standard white projection area; it can be a building, a pool ...

Get Programming Interactivity now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.