I have put quite a lot of effort into learning the basics of the field of computer science known as computer graphics.
In the expression “computer graphics” lies not only the art of programming the pixels (picture elements) of a computer screen, but also things like animation, 3d maths & user interaction, all of which I feel should be outside of the field, not inside. But that’s a rant for another time.
For now, I want to express my deepest sympathy with those new to the computer graphics field, because it is a field riddled with inconsequential legacy knowledge and hidden traps.
One such trap is the notion of bit depth. Many of us have heard of 8-bit, 24-bit and 32-bit bitmaps. Intuitively, this “scale” describes an ever increasing amount of information per pixel; the first format has 8 bits per pixel, and the last 32 bits per pixel.
While that is true, there is much more to it than that.
8-bit bitmaps are based on indexed palettes. This was one of the most popular formats during late 80’s and the 90’s. Every pixel is simply an integer ranging from 0 to 255, which points into a color table. The color table in turn describes the actual color of the pixel.
24-bit bitmaps works quite differently from 8-bit bitmaps. Here, each 24-bit-pixel describes the actual color of the pixel using one byte each. Inconsequential! Since colors are described using Red, Green and Blue components on our screens, each pixel contains of a (R,G,B) triplet.
And finally 32-bit bitmaps turns everything upside-down once more with introducing an “alpha” component. This new thing describes the “transparency” of the pixel. So an alpha value of 0 means a completely translucent pixel, while 255 means completely opaque.
A little image to help clarify things: