Harmony Virtual Lab

Digital Technologies · Data representation: images and file size

Pixels, colour depth and image file size

Change the resolution and colour depth of a picture, watch it get sharper or blockier, and calculate the file size before compression.

Start this experimentAll Digital Technologies experiments

Aim

To find how resolution and colour depth affect image quality and file size.

Apparatus

  • Simulated image (a sunset over hills)
  • Resolution and colour-depth controls
  • File-size calculator

Theory

A digital image is a grid of tiny squares called pixels. The number of pixels across × down is the resolution. Each pixel is stored as a binary number; the number of bits per pixel is the colour depth.

file size (bits) = width × height × colour depth
bytes = bits÷8; 1 KB = 1024 bytes

More pixels or more bits per pixel give a better picture but a bigger file. Formats such as JPEG and PNG compress the data to make files smaller.

Procedure

  1. Choose the resolution (width; the height is three-quarters of the width).
  2. Choose the colour depth.
  3. Look at the picture quality and note the file size.
  4. Record the results.
  5. Repeat for different settings and plot file size against number of pixels.

Precautions

No hazards.

What you do in the virtual lab

Set up the apparatus on screen, take readings and record them in a table (Width (px); Height (px); Pixels; Bits per pixel; File size (KB)), then plot File size (KB) against Number of pixels and read the result from the graph. Simulated instruments give slightly different readings each time, as real ones do. Finish with a short quiz; every answer is explained.

Teachers can set the experiment for a class, see each student’s results and use it as a WAEC- or NECO-style practical paper in exam practice.

Practice questions

  1. A pixel is

    1. a type of camera
    2. a unit of sound
    3. a computer virus
    4. the smallest dot (square) of colour in a digital image
    Show the answer

    D. the smallest dot (square) of colour in a digital image Pixel is short for “picture element”.

  2. An image 100 × 50 pixels has

    1. 5000 pixels
    2. 150 pixels
    3. 50 pixels
    4. 500 pixels
    Show the answer

    A. 5000 pixels 100 × 50 = 5000.

  3. Colour depth means

    1. how dark the picture is
    2. the size of the screen
    3. the number of bits used for each pixel
    4. the number of pictures
    Show the answer

    C. the number of bits used for each pixel More bits per pixel allow more colours.

Do the experiment and the full quiz

Related Digital Technologies experiments

  • Logic gates and truth tablesDigital Technologies · SSS 1 – SSS 2Switch the inputs of AND, OR, NOT, NAND, NOR and XOR gates and build each truth table.
  • Binary, octal and hexadecimalDigital Technologies · JSS 2 – SSS 1Flip eight bit-switches to see how computers store numbers, then hit target values in binary.
  • Programming a robot: sequence and loopsDigital Technologies · JSS 1 – SSS 1Write a program of moves and turns to steer a robot to its goal, then shorten it with a loop.
  • How strong is a password?Digital Technologies · JSS 1 – SSS 2Test made-up passwords, measure their strength in bits and see how long an attacker would need to guess them.
  • Spreadsheet formulas and functionsDigital Technologies · JSS 2 – SSS 2Use cell references, SUM, AVERAGE, MAX and IF to complete a shop sales record and a class result sheet.
  • Coding in PythonDigital Technologies · SSS 1 – SSS 3Write real Python – print, variables, loops and if statements – and have each program checked automatically.