Corrupted CR2 file - corrupt image headers?

Started by iDphotography, January 16, 2013, 02:45:07 PM

Previous topic - Next topic

iDphotography

Hi everyone,

had a corrupted CF card but most of the images were viewable on the camera.
Some had 'cannot playback image' with a thumbnail of the photo, others an interrogation mark.
Other photos were a patchwork of different photos  :o
So I deleted all those and kept the one I could preview.

In LR -> no preview and unable to open the images.
Preview app -> Black and grey blocks
Did some searching and landed on this forum.

This is what I tested:

- extraction of RAW data from bad CR2 file and put it between the image headings of a clean file. -> same result: black and grey blocks
(but maybe I took the wrong headers, saw there are several FF D8 and FF D9's in one file. )
- ~$ exiftool -a -G1 -s /Users/maeling/Desktop/_IDA8088.CR2    -> no errors in exif data
- $ exiftool -b -JpgFromRaw -ext CR2 .  -> gives me nothing but maybe doing something wrong.

I checked some files and all I know is that the ending tag FF D9 is missing.
The hexeditor I have does not allow me to add blocks to the file. I am not a developer so I don't know why.

I still have hope for those images ( at least, some of them). So if someone could have a look at one of them and tell me if I can do something with it?
And if the raw file is for trash, how I could extract a jpeg from it?
I could mail the file.

Thanks in advance!

Phil Harvey

CR2's don't have a JpgFromRaw, but they do have a PreviewImage.  You should try this:

exiftool -b -previewimage -ext cr2 -w _preview.jpg .

(assuming the current directory is the directory containing your CR2 images)

If the metadata is there, this should recover the large preview JPEG images.

- 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 ($).

iDphotography

#2
Hello Phil.

Thanks, that worked great! The preview is quite big : 5760 × 3840 pixels  :)

Tried export on all the files, still got some loss though:

Warning: [minor] Error reading PreviewImage from file - ./_IDA8185.CR2
[...]
Warning: [minor] Error reading PreviewImage from file - ./_IDA8355.CR2
    1 directories scanned
  178 image files read
  168 output files created

I hope the best shots of the show are still in there ^^

Do you think there is any chance to do something with the raw data itself? It's not all zeros.

I'll do some research about the structure of a CR2 file. Those multiple image containers are intriguing me.
Maybe repairing those files is still feasible (still crossing my fingers ^^ ).

Phil Harvey

The Exiftool -htmldump option could be very useful for you here.  Combine this with one or more -v options to see more of the data (large data blocks are not all printed by default).

You may be able to tell if the raw image data is salvageable.

- 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 ($).

iDphotography

Hi Phil,

I didn't tried the htmldump yet but I managed to extract some jpegs from the corrupted files :)
Thanks a lot for your help!! It's not RAW but at least I have something to work with!

Thanks again! I will praise and spread the word about ExifTool!