Worksheet 4 Images
Unit 1 Data representation
Worksheet 4: Images
Task 1
(a) This image uses four colours so requires 2 bits per pixel. Shade in the image as a computer
using the key.
10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 00 00 10 00 00 10 00 00 10 00 00 00 10
10 00 00 10 00 00 10 00 00 10 00 00 00 10
10 10 10 10 10 10 10 10 10 10 10 10 10 10
10 00 00 10 00 00 10 00 00 10 00 00 00 10
10 00 00 10 00 00 10 00 00 10 00 00 00 10
10 00 11 10 10 10 10 10 10 10 10 10 10 10
10 11 11 10 10 10 10 10 10 10 10 10 01 01
10 10 10 10 11 11 10 10 10 10 11 11 10 10
00 00 00 00 11 11 00 00 00 00 11 11 00 00
Key: 01 00 11 10
(b) Calculate the file size of the following images:
Image Number of Colour depth File size in File size in
Resolution colours in bits bits Bytes
Image 1 20 x 20 8
Image 2 10 x 10 8
Image 3 20 x 20 4
1
Worksheet 4 Images
Unit 1 Data representation
(c) How does increasing the image resolution affect the file size?
(d) Explain the relationship between image quality and file size.
Task 2
If you have access to computers with Photoshop or a similar graphics package installed that will
handle .PBM files, you can demonstrate the effect of editing individual pixel values in binary.
Open the file Boat.pbm in Photoshop.
Open the file again in Notepad. This displays the binary values representing the boat:
10 10
0000100000
0001100000
0011101000
0111101100
1111101110
0000101000
1111111111
0111111110
0011111110
0000000000
Using Notepad, alter the 0s and 1s, save it with a different name and open the amended
file in Photoshop.
You should see the effect of your changes!
2
Worksheet 4 Images
Unit 1 Data representation
Task 3
Image Compression
Look at the image below: 14px
10px
11011010 00100101 00110010 10100101
The first and second rows of the image above would be stored as 14 lots of 11011010:
11011010, 11011010, 11011010, 11011010, 11011010, 11011010, 11011010,
11011010, 11011010, 11011010, 11011010, 11011010¸ 11011010, 11011010
The same data could be stored as 00001110-11011010 (14 [binary 00001110] lots of
11011010) without losing any information required to piece together the image again.
This is known as RLE or Run Length Encoding.
Record the data for the third, fourth and fifth lines in the image:
Line
number Binary image data
1 00001110-11011010
2 00001110-11011010