๐Ÿ–ผ๏ธ Image Representation Explorer

OCR Computer Science J277 - Mr Brown

Interactive Pixel Grids

Every bitmap image is really just a grid of pixels โ€” and each pixel's colour is stored as a binary code. Explore how colour depth and resolution change the picture (and the file size) below!

Drag the slider to change resolution, and pick a colour depth to see the effect on quality.

12 ร— 12 pixels

Click a pixel to see its binary colour code.

๐Ÿ”‘ Colour Key

Every distinct colour in this image is stored as one of these binary codes:

๐Ÿ“Š Image Stats & Metadata

Resolution

12ร—12

Colour Depth

2-bit

Possible Colours

4

File Size

18 bytes

Image file size = colour depth ร— width ร— height = 2 ร— 12 ร— 12 = 288 bits

This is uncompressed โ€” the file size depends only on resolution and colour depth, never on what's actually drawn!

MetadataValue
Width12px
Height12px
Colour depth2-bit
File size288 bits
Date created

๐Ÿ† Image Representation Challenges

Challenges Complete

0

Total Points

0

Loading challengeโ€ฆ

๐Ÿ“š Master Image Representation

๐ŸŸฆ What is a Pixel?

A bitmap image is a grid of tiny squares called pixels (picture elements). Each pixel stores one colour, represented by a binary code โ€” so the whole image is really just a big list of binary codes, one per pixel.

๐ŸŽจ Colour Depth

Colour depth is the number of bits used to store each pixel's colour. With n bits, each pixel can be one of 2โฟ colours.

Colour depthColours possible
1-bit2 (e.g. black & white)
4-bit16
8-bit256
24-bit16.7 million (true colour)

Higher colour depth means smoother, more realistic colours โ€” but a bigger file. Try it in the Playground!

๐Ÿ” Resolution

Resolution is the number of pixels across an image's width and height. More pixels means more detail and a sharper image, but also more data to store. Too few pixels and the image looks blocky (pixelated).

๐Ÿงฎ Calculating Image File Size

Image file size = colour depth ร— width (px) ร— height (px)

This gives the size in bits โ€” divide by 8 for bytes, and by a further 1000 for KB.

Example: a 100 ร— 80 image with an 8-bit colour depth:
8 ร— 100 ร— 80 = 64,000 bits = 8,000 bytes = 8 KB

๐Ÿ“‹ Metadata

Metadata is extra information stored with an image file, separate from the pixel colour data itself โ€” for example its width, height, colour depth and the date it was created. It's what lets software display the image correctly.

โœ… What to Remember for the Exam

  • An image is a grid of pixels; each pixel's colour is stored as a binary code.
  • Colour depth = bits per pixel; possible colours = 2โฟ.
  • Resolution = number of pixels across width and height.
  • Higher colour depth or resolution improves quality but increases file size.
  • Image file size = colour depth ร— width (px) ร— height (px).
  • Metadata stores extra info (width, height, colour depth, etc.) alongside the pixel data.