Can corrupt NEF (Nikon RAW) files be repaired?

By | June 18, 2021

Can corrupt NEF (Nikon RAW) files be repaired? A question I frequently get from people that discover my JPEG repair service.

Can corrupt NEF (Nikon RAW) files be repaired?

The answer is similar to the question ‘can a JPEG be repaired?’: If actual data is present then often Nikon RAW files can be repaired. The same is true for CR2 (Canon RAW) or other RAW file formats.

Also the process is very much the same. Ideally in both cases (JPEG and RAW) I have a ‘reference file’. So a photo taken with the same camera with settings matching those from the corrupt file as closely as possible.

Unlike with JPEGs I do not yet have a tool that automates the procedure but that is in the works. For now my only tools are common sense and a hex editor (HxD).

NEF repair procedure

Step 1 is repairing the file to a degree where it allows to be opened using a more forgiving ‘editor’. I found RawTherapy and RawDigger to be excellent for this. Once I am able to open the file RAW data can be exported as TIFF. So result of the repair is mostly a TIFF file.

If the NEF file can not be viewed at all it is often a header issue. If the NEF can be viewed but looks distorted it is often an ‘offset’ issue, data inside the file needs to be properly aligned.

Visually corrupted Nikon RAW (NEF).

Visual corruption / distortion – Nikon RAW – NEF

Repaired visually corrupt NEF (Nikon RAW file)

With data inside file properly aligned we get an intact image. Result is exported as TIFF using the excellent RawDigger tool.

If all else fails

If repair fails it is often possible to extract the embedded full resolution JPEG using my tool JPEG-Repair. Results in a far smaller amount of data of course. Above TIFF from RAW produces about 26 MB of image data. Extracted full resolution JPEG (6000 x 4000 in this case, processed by camera) contains a measly 640 KB worth of image data. So for the embedded JPEG a massive amount of data is tossed away.

Embedded JPEG extracted (6000 x 4000), size reduced for website.

Embedded JPEG extracted (6000 x 4000), size reduced for website.

 

Leave a Reply

Your email address will not be published.