🖼️

Understanding Bitmap Image Representation

May 9, 2025

Lecture Notes: Representing Images in Binary

Introduction to Bitmap Images

  • Bitmap images are stored as 2D arrays of individual pixels.
  • Pixels are the smallest distinguishable feature of an image.
  • Images and monitors are divided into rows and columns of pixels.
  • The size of an image or monitor is expressed in pixels (width x height).
  • Resolution refers to the detail or density of pixels in an image.

Resolution

  • Resolution can be expressed in various ways:
    • Width x Height in pixels
    • Pixels Per Inch (PPI) or Dots Per Inch (DPI)
  • Higher resolution means more details in an image.

Image Capture Process

  • A grid is overlaid on an image to determine pixel color.
  • Each pixel is assigned a binary value based on its color.
    • For black and white images, pixels can be either 0 or 1.
    • For color images, multiple bits are used to represent a pixel.

Color Depth

  • Color depth (or bit depth) is the number of bits per pixel.
  • Black and white images use 1 bit per pixel.
  • Color images require more bits:
    • 3 bits can represent 8 colors (2^3=8).
    • Color depths of 4, 8, and 24 bits can represent 16, 256, and ~17 million colors, respectively.
  • Higher color depth increases image quality but also file size.

Calculating File Size

  • File size can be determined by:

    File Size (in bits) = Width in pixels x Height in pixels x Color depth in bits
  • Convert bits to bytes for practical sizes:

    • 8 bits = 1 byte
    • 1,024 bytes = 1 kilobyte (KB)
    • 1,024 kilobytes = 1 megabyte (MB)

Metadata

  • Metadata is data about data, crucial for displaying images properly.
  • Important metadata for images includes:
    • File name and format
    • Color depth and resolution
    • Camera details (e.g., aperture, make, model) can be included but are not necessary.
  • Metadata helps in processing and displaying the image.

Conclusion

  • Understanding the relationship between resolution, color depth, and file size helps in managing image quality and storage efficiency.
  • Metadata plays a key role in how images are stored and displayed.