Sampling, Compression & Encryption
Keeping What Matters in Smaller Files
Smaller files use less storage and can take less time to transmit. The important decision is what you need back afterward: the exact original file, or an approximation that remains useful. You meet this choice when archiving school records, uploading photographs, or sharing recorded audio. Understanding the difference helps you judge whether a reduction in file size is suitable, rather than assuming the smallest file is always the best choice.
What can be reconstructed?
Lossless compression represents data so that the exact original can be reconstructed from the compressed representation. It can exploit redundancy without discarding information needed to recover the original. A suitable decoder reverses the representation change, restoring every original bit.
Lossy compression reduces the information retained, typically by discarding detail judged less important for the intended use. The reconstructed result is an approximation rather than a guaranteed exact copy. For an image, the visible difference might be subtle at normal viewing size but more noticeable after enlargement or editing.
Some inputs contain little exploitable repetition or predictability. A compressed file also needs information that tells the decoder how to interpret it. Consequently, compression may produce little saving or even a larger file, especially when the input is already compressed.
Choosing a suitable method
Start with the purpose of the file. If the original must be recovered exactly, choose a lossless method. If approximation is acceptable, a lossy method may offer a useful tradeoff between size and quality. The decision depends on the application, not simply on the file's extension.
Decision | Lossless compression | Lossy compression |
|---|---|---|
Reconstruction | Recovers the exact original | Produces an approximation |
Suitable use | Records, program files, editable source data | Viewing or listening copies when approximation is acceptable |
Main consideration | Whether enough size reduction is achieved | Whether the reconstructed quality remains acceptable |
Keep an original when you may need details that a lossy version discards. Putting an already lossy file into a lossless archive preserves that file exactly; it does not restore information discarded earlier. Repeated lossy processing may cause further changes, so quality should be assessed for the actual workflow.
Measuring the reduction
Let So be the original size and Sc the compressed size. Use the same units for both. An original-to-compressed size ratio and the percentage saved are:
Report the ratio as R:1 and state its order, because descriptions of compression ratios can differ. For example, 4:1 in this order means the compressed file occupies one quarter of the original size.
Example: A file shrinks from 10 MB to 8 MB. Its original-to-compressed ratio is 10/8=1.25:1. The saving is 10−8=2 MB, so the percentage saved is (2/10)×100%=20%. The compressed file retains 80% of the original size; that is different from the percentage saved.
If the transmission rate is fixed, a smaller file takes less time to transmit. However, compression itself takes time, so shorter transmission time does not guarantee a shorter overall wait.
What to remember
- Lossless compression permits exact reconstruction; lossy compression permits approximation.
- Choose according to the information that must survive.
- State the order of a size ratio and use matching units.
- Divide the size reduction by the original size to find percentage saved.
Example: Sending a School Records Archive
A school office must send a 24 MB folder of records to its backup server. Every original file must be recoverable exactly. A lossless option produces a 15 MB archive; a lossy option produces a 9 MB archive. The connection transfers files at a constant 3 MB/s. Ignore transmission overhead and consider transmission time only, excluding compression and decoding time.
a) Which compression option satisfies the records requirement?
Lossless compression permits exact reconstruction of the original data. Lossy compression permits information to be discarded and therefore does not guarantee exact reconstruction.
Because every original file must be recoverable exactly, select the lossless option producing the 15 MB archive. Its larger size does not make it less suitable for this requirement.
b) For the selected option, calculate the percentage storage saved and the original-to-compressed size ratio.
First subtract the compressed size from the original size. The size saved is ________.
Next divide the saving by the original size. The saved fraction is ________.
Convert that fraction to a percentage, and separately divide the original size by the compressed size to obtain the ratio.
The selected archive saves 37.5% of the original storage and has an original-to-compressed ratio of 1.6:1. These describe the same reduction in different ways.
c) How long does the selected archive take to transmit, and how much transmission time does it save compared with sending the original folder?
At a constant transmission rate, divide file size by rate. The uncompressed folder would take ________ to transmit.
Apply the same calculation to the selected archive.
Subtract the compressed transmission time from the original transmission time.
The archive takes 5 s to transmit and saves 3 s of transmission time. This comparison excludes the time needed to create and decode the archive, as specified in the problem.
A school encrypts confidential files before storing them on a shared server. Match each term to its role in this protection system.
A parameter used with an algorithm to control its transformation
The operation that recovers the original readable data using the appropriate secret information
The original readable data supplied to the protection process
The transformed data produced by the protection process
Decryption
Cryptographic key
Plaintext
Ciphertext
A student compresses an 18 MB project folder into a 6.3 MB archive. What percentage of the original storage size is saved? Enter your answer as a percentage, to one decimal place.