PNG detects corruption and refuses to open. JPEG opens anyway and shows you the damage. That is the difference. WebP splits the middle, behaving like PNG in lossless mode and like JPEG in lossy mode. Pick the format that fails the way you need it to fail.
How Each Format Detects Damage
PNG: Loud Failure By Design
PNG writes a CRC-32 checksum into every chunk of data. When the file is damaged the checksum will not match, and strict decoders refuse to open it. A corrupted PNG gives you a blank screen or an error message. You get no partial image.
JPEG: Silent Visual Errors
JPEG carries no checksums at all. Damaged data is decoded anyway. The result appears as blocks of wrong colour, banding, or missing sections. The file opens. Parts of the image look wrong, and you may not notice until you need the file at full resolution.
WebP: It Depends on the Mode
WebP uses a RIFF container with chunks named VP8 (lossy), VP8L (lossless), or VP8X (extended). The container does not include per-chunk checksums, so damage detection is weaker than PNG. A corrupted WebP may fail to open or display visual artifacts depending on where the damage lands.
Lossless vs Lossy and Damage Tolerance
PNG: Perfect Pixels, Zero Forgiveness
PNG compression is lossless, using zlib/Deflate. Every pixel is stored exactly. Because the format enforces data integrity, any corruption makes the whole file unreadable. You get perfect quality and zero tolerance for damage.
JPEG: Smaller Files, Visual Forgiveness
JPEG is lossy. It discards information to reduce file size. With no checksums, a damaged file decodes whatever data survives. JPEG tolerates corruption in the sense that you see something. That something may be flawed.
WebP: Two Behaviours, One Format
WebP can be lossy or lossless. A lossless WebP (VP8L chunk) behaves like PNG: corruption causes a full failure. A lossy WebP (VP8 chunk) behaves like JPEG: damage shows up as visual errors.
Truncated Files Partial Recovery
A truncated file ends before the expected end. How each format handles this matters for real-world damage.
- PNG (non-interlaced): A truncated PNG still yields its upper part. The decoder reads chunks in order, so the top rows display and the bottom rows are missing or trigger an error.
- JPEG (baseline): A truncated baseline JPEG also yields its upper part. The image decodes row by row. The top portion appears normally; the rest is cut off.
- WebP: Truncation behaviour depends on the chunk structure. If the RIFF header and image data chunk are intact, the image may display fully. If the VP8 or VP8L chunk is cut, you get a partial image or a failure.
Which Format is Best for Backups?
Use PNG for Archiving
For long-term archiving, you want every pixel preserved exactly. Use PNG. It is lossless and carries strong integrity checks. A corrupted PNG announces itself. That is better than storing a silently damaged JPEG you assume is fine for years.
No Format Replaces Redundancy
Backups on separate media protect images better than any format choice. No file format guards against a failed hard drive or lost cloud storage. Keep copies in at least two physically separate locations.
Practical Advice for Choosing
Match the Format to the Job
Sharing images online where file size matters? Use JPEG or lossy WebP. Archiving original photos or important graphics? Use PNG or lossless WebP. The trade-off is simple. PNG gives you strict damage detection at the cost of larger files and total failure on corruption. JPEG gives you smaller files and visual forgiveness, but no guarantee of data integrity.
When a File Breaks
Encounter a corrupted PNG and the file is unrecoverable through normal means. One wrong byte makes the file invalid. You can try specialised tools, but the checksum is unforgiving. For JPEG, you may still extract a usable image with some artifacts.
What to Do with a Corrupted File
Recovery Steps
Your options with a corrupted PNG or WebP are limited. Restore the correct data from a backup. If no backup exists, try a tool like png.repair. Success depends on the extent of the damage.
- Check if the file is truncated. If so, you might still see the top part of the image.
- If the file has random byte errors, a repair tool may fix the checksums when the image data itself is intact.
- For JPEG, open the file anyway. You can often view it even with visual errors, and some tools mask the artifacts.
- For WebP, test different viewers. Some decoders are more forgiving than others.
- Keep backups. Repair is a last resort, not a strategy.