Main Menu

Corrupted NEF files

Started by Archive, May 12, 2010, 08:54:39 AM

Previous topic - Next topic

Archive

[Originally posted by akudzi on 2009-09-02 09:40:41-07]

Hello forum!

I don't know how this happened, but some of my Raw files have been damaged: Couple of my Raw files are showing the exact same Thumbnail + embedded JPG in my photo-manager. When opening them in UFRaw or Rawstudio, the correct Raw file is loaded.

Can I fix this with exiftool somehow so the correct Thumbnail + embedded JPG is been showing?

Thanks for help! Wink

Archive

[Originally posted by exiftool on 2009-09-02 10:53:40-07]

If you send me a sample (philharvey66 at gmail.com) I will see what
can be done.

- Phil

Archive

[Originally posted by akudzi on 2009-09-02 16:22:57-07]

Hey Phil,

thanks for your help! Have just sent you the mail Wink

Archive

[Originally posted by exiftool on 2009-09-03 11:15:09-07]

Thanks for the samples.  (for everyone else reading this, I was
sent 2 files: 1. a "good" image, and 2. a "corrupted" image.)

This is very interesting.  My guess is that you are using PhotoInfo
to look at these images because structurally they are both fine.  I have
one unconfirmed report that PhotoInfo has troubles viewing edited
NEF files.

The EXIF and large preview (JpgFromRaw) are fine and identical
for both images (other than very minor differences two EXIF tags).
However, there are 3 differences between these files:

1. The structure of the files is different.  Both are valid, but it is
possible that this could cause problems for PhotoInfo.

2) The small preview (PreviewImage) is missing from the 2nd image.
It has been deleted and the length has been set to 0.  This could
also cause problems for other software.  If you want to restore
this, you can use exiftool to add back the preview after
regenerating it either from the large preview or the raw data.

3) And now for the interesting part:  The raw data in the
2nd file is from a different image!  How did you pull this off?  My
guess is that you have written your own utility to do this sort of thing.

- Phil

Archive

[Originally posted by exiftool on 2009-09-03 15:44:23-07]

Ah, right.  If these were 2 different images to begin with, you could
generate the 2nd image by using exiftool to copy all tags from
the 1st image to the 2nd.  I would not recommend doing this
to a RAW image because you will lose some very useful white balance
information (among other things).

- Phil

Archive

[Originally posted by akudzi on 2009-09-08 16:22:44-07]

2) The small preview (PreviewImage) is missing from the 2nd image. It has been deleted and the length has been set to 0. This could also cause problems for other software. If you want to restore this, you can use exiftool to add back the preview after regenerating it either from the large preview or the raw data.

So, how can I extract the PreviewImage from the 2nd (corrupted) NEF file? I'm not so sophisticated with exiftool Sad

3) And now for the interesting part: The raw data in the 2nd file is from a different image! How did you pull this off? My guess is that you have written your own utility to do this sort of thing.

Yeah, the 2nd (and the following files on my storage) are having the info from the 1st NEF file. Really don't know how this happened :S In those days I used exiftool to extract the XMP files from my NEF files to overwrite this data in my JPG photos because my raw converter did not use EXIF at all.

Currently I use Geeqie (a fast & light-wight photomanager for Linux). And having 50+ corrupted PreviewImage in my NEF files is making work with it hard Sad

Thanks for your help! Really appreciated

Archive

[Originally posted by exiftool on 2009-09-08 16:42:55-07]

To see if the previewImage exists, use this command:

Code:
exiftool -previewimage FILE

It will give an output like this if it exists:

Code:
Preview Image        : (Binary data 174872 bytes, use -b option to extract)

And to extract the PreviewImage to a separate file:

Code:
exiftool -previewimage -b FILE > preview.jpg

But like I said, the previewImage is missing from your 2nd image.

- Phil

Archive

[Originally posted by akudzi on 2009-09-09 06:14:13-07]

Ah, now it's clear.

Indeed, the previewImage are missing in the corrupted files.

What do you think about this workaround:

If I convert the corrupted NEF files (with my favourite raw converter) to JPG, can I then write those JPG's back to their original NEF files, as previewimage resp. as large preview?

Is this possbile somehow?

Archive

[Originally posted by exiftool on 2009-09-09 10:43:38-07]

Yes.  This is what I would suggest doing.  For the 2nd image
you sent, you will have to replace both the JpgFromRaw and
the PreviewImage.  The PreviewImage was missing and the
JpgFromRaw was the wrong image.  I suggest scaling the
images to the sizes you find in original images, then
removing all metadata from them (with "exiftool -all=")
before writing them to the NEF.  The command to write them
to the NEF is:

Code:
exiftool "-previewimage<=a.jpg" "-jpgfromraw<=b.jpg" c.nef

- Phil

Archive

[Originally posted by akudzi on 2009-09-10 10:28:53-07]

It's working Smiley Thanks Phil!