Repair Corrupt JPEG Header

If you haven’t already done so, download JPG-Repair:

Requires a sample / reference file:

  • The image file must be undamaged.
  • The image file must be created by the same device (camera or mobile phone).
  • The picture must have the same resolution and should have been taken with the same settings.
  • The picture should NOT be edited using a photo editor or similar.

Time needed: 5 minutes.

Repair a corrupt JPEG File Header

  1. Place corrupt JPEGs + sample in one folder

    Place the corrupt or damaged JPEGs + sample file in one folder. The sample needs to be named to “sample.jpg”. Work on copies of the corrupt JPEG photos!

  2. Run JPG-Repair

    Double click “jpgrepair.exe”. There is no setup, just a single executable file.

  3. Select corrupt file(s)

    Select the drive containing the copies of the corrupt photos.
    Browse to the folder containing the copies of the corrupt photos. If you have for example copied them to a folder on your desktop, you typically select the C: drive > Users > Your username > Desktop > and then the Folder.

    Select the JPEGs you need to repair.

    Hint: To estimate the condition of the files, select the first few one-by-one. See below how to use and interpret entropy info and the byte histogram for estimating the chance for repair.

  4. Start Repair process

    Click “Repair”. JPG-Repair will process all selected files.

This short video shows all the steps to repair a corrupt JPEG header

JPG-Repair fails to repair the JPEG, why?

Often a JPEG is beyond repair simply because although it’s extension is JPG it does not contain (enough) JPEG data. The data entropy and byte histogram may be able to tell what’s wrong:

  • Entropy too low/high: The data inside the file is likely not JPEG data or too much JPEG data is missing.
  • Byte histogram looks very different than the one from a healthy JPEG file

Healthy JPEG. Good entropy, uniform distribution of bytes. High value for zero is common in JPEG

File filled with pattern(FF). Too low entropy, value 255 (&HFF) maxed out

Nothing but zeros in this file. Value 0 to the max, too low entropy

Does not look like JPEG, text probably, too low entropy, uneven distribution of bytes

Symptoms of a corrupt JPEG Header

A corrupt JPEG header may result in a wide variety of symptoms, however most common is that the file can not be accessed at all:

  • Windows Explorer fails to show thumbnail previews.
  • Windows Image viewer fails to open the file: “Can’t open this picture because the file appears to be damaged, corrupted, or is too large”.
  • Windows Photos fails to open the photo: “It looks like we don’t support this file format”.
If the header of a JPEG file is corrupt, in general you will not be able to open the file at all.