Skip to main content
hard-driveINFO

Repair a corrupted JPEG: what is actually recoverable, and the thumbnail almost nobody tries

Before paying for repair software, check three things: whether the file still starts with the JPEG marker, whether it is truncated rather than destroyed, and whether an embedded EXIF thumbnail survived. That last one saves photos people had given up on.

By Eric Gerard · Editor · Save My Disk4 min readPhoto via Pixabay

Before installing anything, it is worth knowing that corrupted covers two very different situations, and only one of them is fixable. Telling them apart takes a couple of minutes and decides whether repair software is worth buying at all.

First, look at the first bytes

Every JPEG begins with the marker FFD8 and a complete one ends with FFD9. That single fact is enough to sort most cases:

# first and last bytes
xxd broken.jpg | head -1
xxd broken.jpg | tail -1

Starts with FFD8, no FFD9 at the end. The file is truncated: the copy stopped, the card was removed, the transfer was interrupted. The data that made it through is intact. This is the most recoverable case, and it is why such photos often display normally down to a certain height and then turn grey or green.

Does not start with FFD8. The header is damaged, or the file is not a JPEG despite its extension. Repair is possible in some header-only cases, but the odds drop sharply.

Starts and ends correctly but still will not open. The damage is inside the image data. Partial rendering is sometimes possible; a faithful reconstruction usually is not.

Torn fragments of printed paper laid side by side in a mosaic
Torn fragments of printed paper laid side by side in a mosaic

The thumbnail almost nobody tries

This is the step worth knowing before you pay for anything.

Most cameras and phones write a small preview image inside the EXIF metadata, near the beginning of the file. Because it sits before the main image data and is a fraction of the size, it very often survives corruption that destroyed the full photo.

exiftool -b -m -ThumbnailImage broken.jpg > thumb.jpg

The -b flag asks for binary output and -m tells ExifTool to ignore minor errors, which matters because the file is damaged by definition. If there is no embedded thumbnail, the output is empty and you have lost nothing but a few seconds.

Be clear about what this gives you: a small image, typically a few hundred pixels wide, not a printable photograph. But when the alternative is a file that opens on nothing, getting back a recognisable version of a photo is often the difference between losing a memory and keeping a trace of it.

What repair tools actually do

They rebuild the container, not the content. A tool can restore a missing header, close a file that has no end marker, or re-encode the recoverable portion into a valid image. That genuinely works on truncated and header-damaged files.

What no tool can do is invent bytes that were overwritten. If another file was written over that area of the disk, the original data is gone, and any product promising otherwise is selling a result it cannot deliver. This is the same honesty line as our guide on repairing a corrupted video file: the container is fixable, missing data is not. A spreadsheet is a different case again, because an .xlsx is a ZIP container you can open and inspect: see repairing a corrupted Excel file.

If the photo is gone rather than broken

The two problems get confused constantly, and the tools do not overlap.

Repair applies to a file you still have, whose contents are damaged. Recovery applies to a file that was deleted, formatted away or lost with a card, where the job is to find the bytes on the device before something else overwrites them. For that second case, carving is the right approach and our TestDisk and PhotoRec guide covers it, as does the walkthrough on recovering photos from a corrupted SD card.

One rule applies to both: stop writing to the storage device immediately. Every new file reduces what can still be recovered, and that includes installing recovery software onto the same drive.

The short version

Check whether the file starts with FFD8 and ends with FFD9, because a truncated JPEG is the most repairable case by far. Try the embedded EXIF thumbnail before anything else, since it costs nothing and often survives when the main image does not. Understand that tools rebuild structure and cannot recreate overwritten data. And if the file is missing rather than damaged, you need carving, not repair.

Editorial pick
4.5 / 5

If the photo is lost rather than damaged → EaseUS Data Recovery

Carving finds deleted images on the device itself. Free scan to see what is still there before deciding, and install it on a different drive than the one you are recovering.

Founded in 200430-day guaranteeFree 2 GB version
See the offer
Editorial pick
4.5 / 5

Recover the data from your hard drive → EaseUS

Free scan · deleted, formatted & lost files · Windows & Mac

Founded in 200430-day guaranteeFree 2 GB version
See the offer

Frequently asked questions

Can a corrupted JPEG always be repaired?

No, and that is the honest starting point. A JPEG whose data was partially overwritten cannot be reconstructed, because the missing bytes no longer exist anywhere. What repair tools genuinely fix is a different situation: a file whose structure is broken while the image data is still present, for example a damaged header or a transfer that stopped early. Knowing which case you are in takes two minutes and decides whether spending money makes sense.

How do I know if the file is truncated or destroyed?

Look at the first bytes. Every JPEG starts with the marker FFD8, and a complete one ends with FFD9. If the file starts correctly but has no end marker, it was almost certainly truncated during a copy or a card removal, which is the most repairable case. If it does not start with FFD8 at all, the header is damaged or the file is not a JPEG despite its extension.

What is the embedded thumbnail and why does it matter?

Most cameras and phones store a small preview image inside the EXIF metadata, near the start of the file. Because it sits before the main image data and is much smaller, it frequently survives corruption that destroys the full-size photo. Extracting it will not give you a printable image, but it often gives you back something recognisable when the alternative was nothing at all.

How do I extract that thumbnail?

With ExifTool, using the binary output and the flag that ignores minor errors, since the file is by definition damaged: `exiftool -b -m -ThumbnailImage broken.jpg > thumb.jpg`. If the file has no embedded thumbnail, the output will be empty, which is itself useful information and costs nothing to test.

Is repairing a JPEG the same as recovering a deleted one?

No, and confusing the two wastes time. Repair applies to a file you still have whose contents are damaged. Recovery applies to a file that was deleted or lost, where the goal is to find the bytes again on the storage device before they are overwritten. If your photo is gone rather than broken, a carving tool is the right approach and repair software will not help.