What is the difference between lossy and lossless image compression?
This tests irreversible discard versus perfect reconstruction. A strong answer defines lossy as dropping detail, lossless as fully reversible, names JPEG, PNG, and chooses lossless for masters, lossy for web. Red flag: claiming lossless is always smaller.
WHAT THIS TESTS: This question probes your grasp of data fidelity trade-offs in image storage and transmission. The interviewer wants to know if you can distinguish between irreversible quantization and reversible encoding, and whether you understand that compression algorithms leverage visual perception and statistical redundancy differently than generic data compression. At the senior level, this is foundational knowledge that underpins decisions in computer vision pipelines, asset management, and latency-sensitive serving systems.
A GOOD ANSWER COVERS: A strong response follows four beats in order. First, define lossy compression as a method that permanently discards information, typically by quantizing frequency coefficients or dropping perceptually less important details, which means decoding never restores the original bit-exact image. Second, define lossless compression as a fully reversible process, such as entropy coding or run-length encoding, where every pixel value is recovered exactly after decompression. Third, give concrete examples: JPEG for lossy, because it uses discrete cosine transform and chroma subsampling, and PNG for lossless, because it uses DEFLATE and preserves exact color values. Fourth, describe a scenario trade-off: choose lossless for archival masters, medical imaging, or repeated editing workflows where generational degradation must be avoided, and choose lossy for web thumbnails, streaming, or mobile delivery where storage and bandwidth budgets dominate and minor perceptual loss is acceptable.
COMMON WRONG ANSWERS: Red flags include conflating compression with image dimensions or resolution, claiming that lossless formats are always smaller than uncompressed sources, or asserting that JPEG is lossless. Another weak pattern is describing the difference only in terms of file size without mentioning irreversibility. Candidates who cannot name a real format or who suggest PNG for high-fidelity photography without acknowledging its larger footprint also signal shallow experience.
LIKELY FOLLOW-UPS: An interviewer might push on generational loss by asking what happens if you open and re-save a JPEG ten times. They could ask about modern codecs like AVIF or HEIC and how their lossy modes differ from JPEG. You might also be asked to compare PNG with lossless WebP, or to discuss when you would use a raw sensor format versus a compressed one in a machine learning training pipeline.
ONE CONCRETE EXAMPLE: Imagine a photography marketplace that stores original seller uploads and generates preview galleries. The correct architecture keeps the original upload in a lossless format such as PNG or TIFF to preserve exact pixel data for future editing or printing. The gallery previews are served as JPEG at eighty-five percent quality because the twenty-fold size reduction cuts CDN costs and improves page load times, and buyers cannot perceive the difference on standard displays.
Source: Wikipedia: Image compression
Read the original → Wikipedia: Image compression
- #image compression
- #lossy vs lossless
- #computer vision
- #file formats
- #data fidelity
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.