Image Representation Formula

Image representation is the way a computer stores a picture as numeric data.

The Formula

file size≈width×height×bits per pixel

Ask yourself: Is a picture being stored or measured as a grid of pixels with color values?

Quick example

A 100 by 100 image has 10,000 pixels. If each pixel stores RGB color, the file needs data for red, green, and blue at every pixel.

What this formula means

Image representation is the way a computer stores a picture as numeric data. Most digital images are made of pixels arranged in a grid, where each pixel stores color information such as red, green, and blue values.

A digital image is a mosaic of tiny tiles, each one a single solid color. The whole picture lives in the list of tile colors and positions, and if you zoom in far enough you see the tiles. Unlike a real mosaic, the computer stores no tiles at all, only numbers: three for each tile, for red, green and blue.

Formal view

A raster image is a function from pixel coordinates (x,y) to color values. Storage size depends on the number of pixels and the number of bits used for each pixel's color data.

Worked examples

Example 1

medium
An image is enlarged on screen from 100x100 to 400x400 pixels by repeating each pixel 4x4 times. Does the file size change, and what visual effect appears?
Show solution

Answer

file size same; pixelation appears

First step

1.
The underlying data is still 100×100 pixel values.

See the full worked solution + why-it-works coaching

SetupKey insightWhy it worksCommon pitfallConnection

Free: full solutions on 3 topics a day. No card.

Every topic, every day: the Family plan

Example 2

hard
Compare 8-bit and 10-bit per channel for one channel: how many MORE levels does 10-bit provide, and by what factor?

Common mistakes

  • Thinking a larger displayed image must contain more pixels
  • Confusing image resolution with compression format
  • Ignoring that more color depth increases file size

Why this formula matters

Knowing how images are stored explains everyday puzzles: why a 4000 × 3000 phone photo would take 36 MB before compression, why a small icon looks blocky when stretched, why a black-and-white drawing can be far smaller than a photo, and why editing one pixel means changing three numbers. It also lets you predict how a change in resolution or color depth changes the file size.

Frequently asked questions

What is the Image Representation formula?

Image representation is the way a computer stores a picture as numeric data. Most digital images are made of pixels arranged in a grid, where each pixel stores color information such as red, green, and blue values.

How do you use the Image Representation formula?

Use image representation when a question involves pixels, resolution, color values such as RGB, or the size of an image file. Typical tasks: work out how many bytes an image needs, decode a small grid of bits into a picture, or explain why an enlarged image looks blocky. If the question is how to make the file smaller, that is Data Compression. If it is about representing data in general (text, sound), that is Data Representation.

Why is the Image Representation formula important in CS Thinking?

Knowing how images are stored explains everyday puzzles: why a 4000 × 3000 phone photo would take 36 MB before compression, why a small icon looks blocky when stretched, why a black-and-white drawing can be far smaller than a photo, and why editing one pixel means changing three numbers. It also lets you predict how a change in resolution or color depth changes the file size.

What do students get wrong about Image Representation?

Resolution and file format are different ideas. Two images can have the same resolution but different file sizes.

What should I learn before the Image Representation formula?

Before studying the Image Representation formula, you should understand: data representation, binary.