← Image Processing for EveryoneToolsInVisionLearning Center
Compression and Storage · Lesson 69

Lossless Versus Lossy Image Storage

An archive must retain a master image and send smaller viewing copies.

Read the full lesson and open its transcript below. A narrated video will be added after production.

Lesson overview

What you will learn

An archive must retain a master image and send smaller viewing copies.

  1. A practical question
  2. The useful idea
  3. Work through the example
  4. Limits and next step
01

A practical question

The workshop archive needs a master photograph for future measurements and a small copy for quick viewing. Two storage choices sound similar but have different promises. Lossless compression can reproduce the stored pixel values exactly after decoding. Lossy compression permits differences to make the file smaller.

02

The useful idea

That promise starts with the pixels already in the file. A lossless format doesn't undo sensor noise, a clipped highlight, or detail lost when the image was sampled. It simply preserves the stored array through the save-and-load cycle.

03

Work through the example

Take a known original, save a lossless copy and a lossy copy, and decode both. Compare corresponding pixel values exactly, not just the file names or how the pictures look on one screen. The lossy view may be acceptable for browsing but may change a tiny scratch that our inspection depends on. Saving a file with a familiar extension does not prove its pixel values survived. Decode the original and the saved copy, and compare their arrays under the same color and bit-depth convention. A lossless format can preserve exact values, while a lossy one trades some information for smaller files. Store the raw original when downstream measurements need traceability. Judge any compression against the actual task, not just the storage size or how similar two previews look. Now check the idea on a concrete example: Decode both versions and compare exact pixel arrays, not only filenames. A possible trap is worth naming: Lossless does not mean the camera captured all scene information. The answer follows from that evidence: Lossless compression reproduces stored pixel values exactly; lossy compression permits differences to save space. Save one untouched master and a smaller viewing copy of the same photograph. Decode both and compare pixel arrays when exact preservation matters, rather than trusting the words printed in a filename.

04

Limits and next step

Keep the calibrated master and its metadata safe, and label derived viewing copies. Next, we'll inspect a common visual sign of stronger block-based compression.

Worked example

Decode both versions and compare exact pixel arrays, not only filenames.

Knowledge check

Quick check: test your understanding

Try it yourself: Consider this case: Decode both versions and compare exact pixel arrays, not only filenames. Explain how you would check the result. In your answer, address this limitation: Lossless does not mean the camera captured all scene information.

Check the reasoning

Lossless compression reproduces stored pixel values exactly; lossy compression permits differences to save space. Lossless does not mean the camera captured all scene information.

What is the main idea behind lossless versus lossy image storage?

Lossless compression reproduces stored pixel values exactly; lossy compression permits differences to save space.

How is it used in the example?

Decode both versions and compare exact pixel arrays, not only filenames.

What limitation should be checked?

Lossless does not mean the camera captured all scene information.

Further reading

Digital Image Processing, 4th edition — Rafael C. Gonzalez and Richard E. Woods.

Original ToolsInVision teaching examples. Editorial approach · Suggest a correction

Accessible referenceLesson 69 transcript323 words · Narration ready for the upcoming videoOpen transcript

The workshop archive needs a master photograph for future measurements and a small copy for quick viewing. Two storage choices sound similar but have different promises. Lossless compression can reproduce the stored pixel values exactly after decoding. Lossy compression permits differences to make the file smaller.

That promise starts with the pixels already in the file. A lossless format doesn't undo sensor noise, a clipped highlight, or detail lost when the image was sampled. It simply preserves the stored array through the save-and-load cycle.

Take a known original, save a lossless copy and a lossy copy, and decode both. Compare corresponding pixel values exactly, not just the file names or how the pictures look on one screen. The lossy view may be acceptable for browsing but may change a tiny scratch that our inspection depends on. Saving a file with a familiar extension does not prove its pixel values survived. Decode the original and the saved copy, and compare their arrays under the same color and bit-depth convention. A lossless format can preserve exact values, while a lossy one trades some information for smaller files. Store the raw original when downstream measurements need traceability. Judge any compression against the actual task, not just the storage size or how similar two previews look. Now check the idea on a concrete example: Decode both versions and compare exact pixel arrays, not only filenames. A possible trap is worth naming: Lossless does not mean the camera captured all scene information. The answer follows from that evidence: Lossless compression reproduces stored pixel values exactly; lossy compression permits differences to save space. Save one untouched master and a smaller viewing copy of the same photograph. Decode both and compare pixel arrays when exact preservation matters, rather than trusting the words printed in a filename.

Keep the calibrated master and its metadata safe, and label derived viewing copies. Next, we'll inspect a common visual sign of stronger block-based compression.