Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
A student must compress two files.
Compression reduces file size: less storage, less bandwidth and a shorter transmission time. Lossy compression removes data for good (lower resolution or colour depth, lower sample rate or resolution). Lossless compression loses nothing; run-length encoding stores each run of repeated values as a count and a value.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.
Step 1. File A. There are 7 runs of length 1: (1, A), (1, B) and so on. That is bytes, twice the original 7 bytes. RLE makes this file bigger, so it should not be used.
Step 2. File B. The new photo is 512 by 512 pixels. of the pixels, and so 0.25 of the size.
Step 3. Lossy or lossless. Lossy: three quarters of the pixels are removed for good, so the original detail cannot be rebuilt.
Check. The original is bytes, which is 3 MiB. The new one is bytes, which is 0.75 MiB, a quarter of 3 MiB.
Answer: (a) 14 bytes; no, it doubles the size. (b) 0.25. (c) Lossy.
Log in to join the discussion.
Loading…