A bitmap image, also known as a raster image, is a digital picture stored in computer memory as a matrix of pixels. Each pixel represents the smallest unit of the image and holds data for a specific point in the image. The term "bitmap" originates from the computer programming terminology, meaning literally a map of bits, or a spatially mapped array of bits.

In a bitmap image, each pixel is typically represented by one or more bits. The number of bits per pixel, known as the bit depth, determines the number of colors that can be depicted in the image. Common bit depths include:

image.png

When bitmap images are stored as files, they use various file formats like BMP, JPEG, GIF, and PNG, each of which has its own method for organizing and compressing pixel data.

Viewing Bitmaps as Arrays in Python/Numpy

In computer programming, particularly when using data manipulation libraries like NumPy, bitmap images are often treated as arrays of pixels (aka. matrix or tensor). Each pixel is an element in the array, and the array's dimensions correspond to the image's dimensions:

embed (16).svg

embed (15).svg

Using arrays to represent bitmap images allows for efficient processing, manipulation and automation (e.g., writing a script to process a batch of images).

Operations like color transformation, filtering, and geometric transformations can be performed by applying numerical computations to the array elements. This array-based representation of images is a cornerstone of image processing tasks in computer vision and digital graphics.