How to repair a corrupted JPEG photo

By | February 26, 2019

How to repair a corrupted JPEG photo may seem a simple question but the answer isn’t. Many people seem to expect to run some JPEG Repair software and that fixes it. And that’s what many of my competitors promise. If only it were that simple. Now, let’s take this one step at the time to see IF a JPEG photo can be repaired, and if so how.

How did the JPEG image become corrupted?

And why does it matter?

On my JPEG Repair Service web page I specifically ask for this information because it is somewhat vital. It makes a world of difference if the JPEG was corrupted just sitting on a hard disk, or after it was transferred from a memory card to a computer or if it is the result of file recovery or undelete.

Example 1: File corrupted after transfer from camera or memory card to PC.

Many things can go wrong when transferring a file from one device to another. All involved hardware can cause errors. The reader, the cable, the slots in which you insert the card, the slots were you insert the cable etc..

Key is, IF the JPEG was okay before the transfer and corrupted after, then probably you do not want to repair the corrupted JPEGs, instead you first try to to get them from the source. If photos were transferred using a copy/paste operation (source deleted after copying) you need to recover them.

So, in this case we need recovery rather than repair.

Suggested software:

PhotoRec is a free and open source data recovery carver available for many different platforms (Windows, Linux, Mac).

JpegDigger is my own carver specifically designed for JPEG with some more advanced features.

Example 2: Files corrupted after undelete or file recovery.

Although you first instinct may be trying to repair the corrupted JPEG photos, in many cases repair is a lost cause. I speak from experience. This is due to the fact that in many cases file recovery software like Recuva or Easeus Data Recovery does indeed ‘produce’ JPEG files with the correct filename, size and extension, however the files don’t actually contain JPEG data. For repair to be possible, actual JPEG data is required.

So, again this case we need better recovery. We now need to take into account what type of media the data needs to be recovered from.


Suggested software:

ReclaiMe is IMO the best choice for the novice. It offers the power of a high end file recovery tool and yet delivers that through a super easy to use interface.

Memory card:

PhotoRescue is a commercial product employing several recovery methods

PhotoRec is a free and open source data recovery carver available for many different platforms (Windows, Linux, Mac).

JPEG Recovery LAB is a commercial advanced carver that can even recover photos corrupted due to fragmentation. It recovers more intact files than ordinary undelete and photo recovery tools.

Want to try to repair the files anyway using JPEG repair software? Try these (downloads):

Stellar Repair for Photo (was Stellar JPEG Repair).

Hetman File repair.

JPG-Repair Toolkit (my own utility).

Example 3: First half of photos on memory card is okay, second half corrupted.

These photos are most likely beyond repair and / or recovery and the result of a fake memory card. A fake memory card contains less memory than advertised and due to hacked firmware this goes unnoticed. Often there is one half grey photo which happens to span real memory and fake memory. So half of it was actually stored, second half is not.

Testing if corrupted files are due to a fake memory card is simple:

  1. When opened in a hex editor the files contain only zeros or a FF byte pattern
  2. When compressed using WinZip or WinRar resulting ZIP file size is a fraction of the original file size. With intact JPEGs, compressed file will be almost the size of the original.

Example 4: Photos kept on a hard drive go corrupt due to ‘Bit rot’.

Archived photos gradually corrupt while just sitting on a hard disk. You can try to repair these using JPEG Repair Software.

Stellar Repair for Photo (was Stellar JPEG Repair).

Hetman File repair.

As JPG-Repair Toolkit requires a sample file, it is often unpractical in situations like these. Unless the corrupted JPEG can still be opened but is distorted which may be repairable using the JPEG bit stream editor.

Example 5: Photos copied from Android smart phone are corrupted

Often these are technically not corrupted but encrypted. I know of no solution for this problem.

You can tell by using JPG-Repair Toolkit: Select extract JPEG > Open file > Click Repair. Now look at the value for entropy (top-left corner). If bits/byte value is 8 then the file is probably encrypted.

If opened in a hex editor you’ll notice the lack of JPEG magic bytes FF D8 FF and the string CONSOLE in the first sector of the file.










Leave a Reply

Your email address will not be published. Required fields are marked *