Stewdent.eu
▾

Pixels and Images

Digital images are made up of tiny squares called pixels, each storing colour data as binary numbers.

Last updated: 18 November 2025

★★☆☆☆ Level 2computingDatadata-representationpixelsimagesColour4 min read

Report an error

What is a Pixel?

A pixel (short for picture element) is the smallest individual dot in a digital image. Zoom in far enough on any photo on your screen and you will see a grid of tiny coloured squares — those are pixels.

Every image has a resolution, which describes how many pixels it contains. A "1920 × 1080" HD display has 1,920 pixels across and 1,080 pixels down, giving a total of 2,073,600 pixels — over two million!

How Colour is Stored

Each pixel stores a colour. The most common system is RGB (Red, Green, Blue): each pixel has three values, one for each colour channel.

Each channel is stored as a number from 0 (none of that colour) to 255 (maximum). Since 256 = 2⁸, each channel needs 1 byte (8 bits), so a full-colour pixel needs 3 bytes (24 bits).

ColourRedGreenBlue
White255255255
Black000
Red25500
Yellow2552550
Custom100149237
Note

24-bit colour (3 bytes per pixel) can represent 256 × 256 × 256 = 16,777,216 different colours. This is more than the human eye can distinguish, which is why most photos look realistic on screen.

Calculating Image File Size

You can estimate the uncompressed size of an image using this formula:

File size = Width × Height × Colour depth (in bytes)

Example: A 200 × 100 pixel image at 24-bit colour:

  • 200 × 100 = 20,000 pixels
  • 20,000 × 3 bytes = 60,000 bytes ≈ 60 KB

A 12-megapixel photo would be around 36 MB uncompressed — this is why image compression (JPEG, PNG) is so important!

Colour Depth

Colour depth is the number of bits used to store each pixel's colour. Common values:

Colour DepthBits per PixelColours Available
1-bit12 (black & white)
8-bit8256
24-bit2416.7 million
32-bit3216.7 million + transparency
Tip

The extra 8 bits in 32-bit colour is called the alpha channel — it controls transparency. This is used in PNG images, where some pixels can be semi-transparent or fully see-through.

Metadata

Image files also store metadata — extra information about the file such as the camera model, date taken, GPS location, and image dimensions. This adds a small amount of extra data on top of the pixel values.

Practice Problems

Calculate the uncompressed file size in kilobytes of a 640 × 480 pixel image stored at 24-bit colour depth.

Show answer
640 × 480 = 307,200 pixels. Each pixel uses 3 bytes (24 bits ÷ 8). 307,200 × 3 = 921,600 bytes = 900 KB (using 1 KB = 1,024 bytes).

An image uses 8-bit colour depth. How many different colours can it display, and how does this compare to 24-bit colour?

Show answer
8-bit colour can display 2⁸ = 256 colours. 24-bit colour can display 2²⁴ = 16,777,216 colours — about 65,536 times more colours than 8-bit.