JPG-Repair – Fix and Repair corrupt JPEG headers and invalid markers

JPEG Repair Software – JPEG Repair Tool – Fix and Repair corrupt JPEG headers yourself

Something I have been doing lately is looking into repair of damaged and corrupt JPEG photos. I have been offering a JPEG repair service for a while now. Learning from that I have created a utility that addresses most common issues with corrupt and damaged JPEG files. Creating such a utility has been a long standing wish and I am very happy to finally have such a tool available.

An easy to use alternative for replacing headers with a hex editor

Fix and Repair corrupt and damaged JPEG headers using JPG-Repair. JPG-Repair can repair corrupt JPEG headers using a reference or sample file. It is an easy alternative for replacing a corrupt header with an intact one using a hex editor. A typical symptom of a corrupt header is that the JPEG file can’t be opened at all. Windows explorer does not show preview thumbnails and different viewers and photo editors may show different error messages.

It can also repair Invalid JPEG Markers and other invalid data within the JPEG image bit stream. Typical symptoms are the picture abruptly changing at a grey area, image shift and distorted color bands (see below example).

Although you are ‘editing’ the image, JPG-Repair dos not re-encode the image as a ‘normal’ photo editor would do.

Features:

  • Repair corrupt and damaged JPEG files
  • Fix corrupt JPEG header
  • Repair Invalid JPEG markers
  • Attempts to repair damage due to bad sectors
  • Allows you to improve corrupt JPEG image data by patching the bit stream
  • Does not re-encode JPEG image!
  • Preview of repaired file
  • Free version that shows previews + saves files. Correct preview, then file can be repaired? Limitation of the free version: Batch mode disabled. Please register if you find the software useful.
Automatically repair and fix corrupt and damaged JPEG photos and manually improve errors due to bad sectors and invalid JPEG markers

Automatically repair and fix corrupt and damaged JPEG photos and manually improve errors due to bad sectors and invalid JPEG markers

 

The freeware version of this jpeg repair software is functional but batch mode is disabled.

This download is free of adware and other crapware!

 
 

Reference File

The reference or sample file should be taken with the same camera as the corrupt image(s). Also, the settings (resolution, quality and orientation) of the sample file need to match the corrupt files. If unknown then you would need to experiment by taking different shots with different settings using the original camera (same brand and type).

 

Windows photo viewer doesn’t like this file! The result of a corrupt JPEG header.

Fix and Repair corrupt JPEG headers

I suggest, I urge you to work on copies of the corrupt files!

Repair guides for fixing corrupt JPEGs:

Category 1, corrupt JPEG Header:

The first type of errors in corrupt JPEG files is corrupt headers. Typically you will observe the following symptoms:

  • No thumbnail previews.
  • Error messages when opening the files. Windows Photo Viewer will state the file appears to be damaged, corrupted or is too large. Windows Photos will tell it looks like we don’t support this file format.

Instructions to repair JPEG files that will not open.

Category 2, Invalid markers and errors in JPEG bit stream:

In this case the image file actually opens, but the picture looks distorted:

  • Only part of image is displayed, bottom half is grey.
  • Image shifts.
  • Colors ‘shift’.
  • Image viewer/editor complains about invalid jpeg marker.
  • Image briefly appears intact, then image disappears or corrupt image shows. This is typically the case when the embedded preview JPEG is still intact.

Instructions to correct image shift and color errors.

We did Raymond.cc’s challenge: repair-and-fix-corrupted-images

Raymond.cc’s challenge: repair-and-fix-corrupted-images. We win!

JPGRepair against the competition using the Raymond.cc test method and images! Click image to read the blog-post. For one, this test shows how hard automatic JPEG repair actually is.

It doesn’t work!

* Files remain corrupt (can not be opened)

Then JPGRepair was unable to find actual image data within the corrupt files. A very common cause for this to happen is that although the file has a > 0KB file size and a JPG extension, it is actually empty.

To check: Use a hex editor such as HxD to open the file. Commonly, empty files contain only zeros or a FF FF FF byte pattern. Such files can not be repaired at all.

Check corrupt JPEG files using HxD. This corrupt JPEG is beyond repair.

Check corrupt JPEG files using HxD. This corrupt JPEG is beyond repair.

It is also possible the damage corrupted the header + part of the image data (like part of file was overwritten). As such it is impossible for JPGRepair where the actual image data starts (SOS marker) and it can not merge an intact header with the image data.

* Files look totally weird or psychedelic now

Possibly your are not using the correct header (wrong resolution for example)

Wrong JPEG header chosen for this file ..

Wrong JPEG header chosen for this file ..

* File properties are lost

Part of the header of a JPEG may include info about the photo, like camera model, settings, flash fires yes/no etc.. JPGRepair strips non essential parts from the header of the sample file and therefor such info may indeed be lost.

Certain details that were present (properties of photo, camera make and model etc. will be lost in repaired JPEGs.

Certain information that was present (properties of photo, camera make and model, thumbnail, preview etc. will be lost in repaired JPEGs. This does not affect the quality of the image though.

I get a SmartScreen warning when running JPGRepair

See this when running JPGRepair? It means I have recently updated the software and SmartScreen doesn’t recognize it yet. Click More info > Run anyway.

Credits

The idea for this tool is not original and basic concept was ‘copied’ from Wim Vanmaele’s utility repair-jpeg. I can’t find the original source for this program but it can still be found here: http://directory.s2services.com/jpg-bmp.htm.

Support

If you have other issues then feel free to contact me. Send me your sample file + some corrupt files so I can examine them.

2 thoughts on “JPG-Repair – Fix and Repair corrupt JPEG headers and invalid markers

  1. stofa

    Hi,

    i have a question, i have maybe the problem with wrong header of sample, how could i find, that i have correct one or how could i change to correct one?

    Thanks for answer

    Reply

Leave a Reply

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