Main Menu

Corrupted .nef files

Started by Montagnard65, December 01, 2016, 02:05:34 AM

Previous topic - Next topic

Montagnard65

Hi there,
It seems Exiftool could solve my problem but I don't know how... I try some commands, read in others thread, but of course without understand, it doesn't works...
Anyway, this is my problem :
During a saving, 95% of my nef files were corrupted (and some jpeg ; so, thousands of my pictures are unreadable... :-( ) and I realised it after deleting the originals... The size of the pictures are the same than it should, and when I open a corrupted nef with an hexa reader, I can read some information, but the header is unreadable by exiftool.
Do you some tips to solve it ?

Thanks !

PS : sorry for my bad english...

Hayo Baan

Can you share a sample image so we can have a look?
(a nef file will be too big to post here, but you can use e.g. a transfer service to store it and share the link here)
Hayo Baan – Photography
Web: www.hayobaan.nl

Montagnard65

Of course, thanks for your reply.
This is a good one :
https://share.mailbox.org/ajax/share/0ed76084084bcb43e97213584bcb4684bda66430869bf572/1/8/MzQ/MzQvMw
And this a corrupted one :
https://share.mailbox.org/ajax/share/01a85cf40570084d1e81d455700849edadef6a4b3997bbb6/1/8/MzQ/MzQvMg

Hayo Baan

I took a look at the files and if they are both from a D90 then I'm afraid the bad one is corrupted beyond recovery :(
I did see a lot of data that seemed recognisable, but not a "file start" I recognised.

On a positive note, with Phil's extract preview script (@Phil, you should really put this somewhere on your home page ;)), I was able to extract a 4288x2848 pixel preview from the file (a B&W photo of two boys)!

So, while the original seems unrecoverable to me (but perhaps Phil can do some more magic than me), you at least can recover the JPG from this file, so hopefully from the others as well.
Hayo Baan – Photography
Web: www.hayobaan.nl

Montagnard65

Hi Hayo,
I tried the script but it told me :

This scripts requires Image::ExifTool -- please install it.

I'm not sure to understand what it needs because Exiftool is installed :

MacBook-Pro-Benjamin:~ benjamin$ exiftool -ver
10.36


What is missing ?

OK, if Phil could do a tricks to get back my nef file, it will be awesome, but if I can get back a high resolution jpeg it's already very good !

For my culture, in my case, flags of header are probably broken, but if I rebuilt a basic header, do you think I can get back the nef file ?

Hayo Baan

To be able to use Phil's script you need to install the full Perl version of exiftool, not just the executable. On Windows this also means you have to install a version of Perl. ActivePerl is one of the versions I'd recommend in that case. If this gets too complicated, I'm very much willing to do the conversion for you if you can point me to a place to download your nefs.
Hayo Baan – Photography
Web: www.hayobaan.nl

Montagnard65

Thanks Hayo for your help, I will try first to do it by myself, but I'm not sure what I have to do :
- Where can I find the full Perl version of Exiftool ? And how can I Install it (I'm a mac user) ?

Have a good week end!

Hayo Baan

#7
Since you're on a Mac, it's pretty easy to install the full thing. The first download link on the main page gives you the tar.gz file you need. Then just follow the instructions for the full unix install (this requires the XCode command line tools to be installed which you may not have, so install these first (free from Apple)).

Good luck :)
Hayo Baan – Photography
Web: www.hayobaan.nl

Phil Harvey

An alternative is to just add this line to your script before "use Image::ExifTool;":

BEGIN { push @INC, '/usr/local/bin/lib' }

(since the ExifTool libraries are installed in that directory by the Mac package)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Montagnard65

Wahoooo !! It's awesome, I tried with some of my corrupted pictures and it works ! Thank you very very much both of you!! :-)

Phil, if I may abuse, could you have a look on my corrupted picture, to see if I really can't get back a useful stuff ? It could be magical if I can have a picture with more "details" for touch up. If you have no time to have a look, no problem, could you only advise me on "literature" which explain how are built the .nef files (flags, headers, etc) ?

Thanks again for your great job !

Benjamin

Phil Harvey

Hi Benjamin,

I took a look at your file.  It seems to be part of an NEF file, and there is some metadata there.  I can fairly easily recover the date/time of the image (using strings FILE | grep -E "\d{4}:\d{2}"), but it would require some effort to extract anything else.  I don't have any automated tools that will help with files like this (other than the extract_preview script). 

The NEF files use a TIFF format.  Look at the TIFF 6 specification for details.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).