- #1

Villiers

- 7

- 0

- Homework Statement
- The file size of this image is calculated by firstly determining the resolution or how many pixels there are: 20 x 20 = 400 pixels.

Each pixel is described by 8 bits so the file size is: 400 pixels x 8 bits = 3,200 bits or 400 bytes.

a) Run length encoding is applied to the file in order to reduce its file size. An encoded sequence of the same data is stored as 2 bytes: the value of the repetition and the colour code. For example the first line would be stored as 20W (the W would be the binary code for white but is summarised here as a character).

For each line show how the data would be encoded using the format: [LengthColour]. The first and fourth lines have been done for you.

(W=White, K=Black, R=Red, Y=Yellow, B=Blue, N=Brown)

- Relevant Equations
- b) Determine what the RLE compressed file size is bytes

Line Run length encoded sequence

1 20W

2 20W

3 20W

4 8W5K7W

5 8W5K7W

6 8W5K7W

7 8W5K7W

8 9W3K8W

9 7W7R6W

10 6W4R1Y4R5W

11 6W1R1W5R1W1R5W

12 6W1R1W2R1Y2R1W1R5W

13 6W1R1W5R1W1R5W

14 6W1R1W2R1Y2R1W1R5W

15 9W3B8W

16 9W3B8W

17 9W3B8W

18 9W3B8W

19 9W3B8W

20 8W5N7Wthe answer is 152 bytes but i don't understand how they arrived at this number.

any help would be appreciated.

1 20W

2 20W

3 20W

4 8W5K7W

5 8W5K7W

6 8W5K7W

7 8W5K7W

8 9W3K8W

9 7W7R6W

10 6W4R1Y4R5W

11 6W1R1W5R1W1R5W

12 6W1R1W2R1Y2R1W1R5W

13 6W1R1W5R1W1R5W

14 6W1R1W2R1Y2R1W1R5W

15 9W3B8W

16 9W3B8W

17 9W3B8W

18 9W3B8W

19 9W3B8W

20 8W5N7Wthe answer is 152 bytes but i don't understand how they arrived at this number.

any help would be appreciated.