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's really being asked
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.
The full answer
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.
The mistakes people make
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.
What usually comes next
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.
A 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.
Interview question
A photography platform archives original images for future editing and serves compressed previews. Which strategy best preserves fidelity while optimizing delivery?
- a.Store originals as JPEG at maximum quality and serve previews as PNG to eliminate compression artifacts.
- b.Use JPEG at the highest quality setting for both archives and previews to maintain visual consistency.
- c.Keep originals as PNG and serve previews as PNG to preserve exact pixel data at every stage.
- d.Store originals in a lossless format and serve previews as lossy JPEG to reduce bandwidth.Correct
Why? this is the answer
Lossless storage preserves bit-exact originals for future editing and avoids generational degradation, while lossy JPEG cuts preview sizes for faster web delivery. Option C is tempting because PNG guarantees exact pixels, but serving previews losslessly wastes bandwidth without perceptible quality gains over a well-compressed lossy image.
Just read this? Test yourself on what you have been reading.
Read the original → en.wikipedia.org
- #image compression
- #lossy vs lossless
- #computer vision
- #file formats
- #data fidelity
You just looked this up. Could you explain it out loud?
That is the part interviews actually test. Tezvyn takes questions like this one and gives you what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles