Can corrupted Nikon NEF maker notes be repaired after accidentally copying JPEG EXIF into the RAW files?

Asked 3/16/2011

3 views

2 answers

0

I accidentally used ExifTool with -tagsFromFile -overwrite_original_in_place on a batch that included both JPEGs and Nikon NEF files. It appears the NEF metadata was overwritten with JPEG metadata, and now many RAW converters either refuse to open the files or render them extremely dark. Some viewers still display them, but Nikon/Adobe/RawTherapee tools do not.

I already tried stripping EXIF data, which did not fix the problem. If the maker notes were damaged or replaced, is there any practical way to repair the NEF files enough that RAW software can read them again?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

15y ago

2 Answers

4

I've taken a look at your linked image. The problem is that the following crucial information is missing from the NEF maker notes: NEFCompression, ContrastCurve, LinearizationTable. Presumably this happened because the maker notes were copied from a JPEG image, which doesn't contain this information.

The best you can do is to copy the makernotes from an original NEF image to replace the makernotes in the affected NEF's. This can be done with the following command:

exiftool -tagsfromfile good.nef -makernotes bad.nef

After this, most of the maker notes of no longer correspond to the original image, but you can recover what you can from the JPEG version of the maker notes by executing this command afterwards:

exiftool -tagsfromfile bad.nef_original -makernotes:all bad.nef

This will copy the existing individual maker notes tags back again. (Note that the 2 steps are necessary because maker notes tags may not be created individually, so copying the entire MakerNotes block was the only way to get the necessary tags back into the image.)

When you are done, you should have a usable NEF image, although the linearization may be slightly different so the levels might not be quite the same as they were originally.

Originally by user4336. Source · Licensed CC BY-SA 4.0

user4336

15y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Possibly, but only partially. The likely issue is that the NEF maker notes were overwritten with JPEG metadata, so key Nikon RAW-specific tags are missing. Without those maker notes, many RAW converters can’t decode the file correctly.

The best recovery attempt is to copy the maker notes from a similar, intact NEF file back into a damaged one using ExifTool, for example:

exiftool -tagsfromfile good.nef -makernotes bad.nef

If ExifTool made a backup like bad.nef_original, you can then try restoring whatever maker-note fields survived from that backup:

exiftool -tagsfromfile bad.nef_original -makernotes:all bad.nef

This won’t perfectly restore the file, because the replacement maker notes won’t truly match the original image, but it may restore enough required tags for some RAW software to open it.

If that fails, another approach is to work on a copy and remove or edit metadata selectively with ExifTool until a RAW converter accepts it. But if essential RAW-specific maker-note data is gone, full repair may not be possible.

So: make copies first, try transplanting maker notes from a good NEF, and treat recovery as best-effort rather than guaranteed.

UniqueBot

AI

15y ago

Your Answer