Page 1 of 1

PhotoRec truncates JPGs from Olympus camera

Posted: 14 Sep 2014, 21:07
by RfMw
About a month ago over 100 pictures disappeared from a SD card. I tried to get them back using selfmade scripts and such. It took me several evenings, but in the end I had my pictures back and I learned a lot on the way.

A few days ago I heard about PhotoRec. To see whether it might be helpful in future cases of data loss, I tried it on the SD card image (dd-format) of previous month.
PhotoRec could recover the JPGs and ORFs, however the JPGs recovered by PhotoRec are shorter than the originals (by about 1/2 MBytes). They can be displayed without errors, though.

What seems to happen is as follows:
Some cameras append a preview image (larger than the EXIF thumbnail) at the end of the JPG file (behind the EOI).
Some cameras use the multi picture file format for this, e.g. the Panasonic GH1. PhotoRec knows this file format and recovers such JPGs as .mpo including the preview image.
Some other cameras, e.g. Olympus OM-D E-M1, use a non-standard way and record the presence and position of the preview image only in the maker notes (within the EXIF header). PhotoRec doesn't seem to know about this and thus truncates the JPG file after the first EOI, cutting off the preview image.

It's debatable whether this truncation is harmful (probably only Olympus cameras can make use of the preview image anyway). But if you would like to amend PhotoRec such that it can handle these JPGs correctly:
  • I could provide you with some sample JPGs, if you tell me how I can transfer a few files of 5 MB+ to you.
  • Exiftool can extract PreviewImageStart and PreviewImageLength, so it might be helpful to have a look at Exiftool and how it finds out these values.
Unfortunately I'm not a C programmer, so I can't provide code.
I don't know whether other cameras (Canon, Nikon, Pentax, Sony, ...) also append preview images and, if so, how they make its presence known.

Cheers
Rf Mw

Re: PhotoRec truncates JPGs from Olympus camera

Posted: 15 Sep 2014, 20:43
by cgrenier
Can you email me some unmodified jpg from your Olympus camera ?

Re: PhotoRec truncates JPGs from Olympus camera

Posted: 17 Sep 2014, 07:28
by cgrenier
I confirm the problem: PhotoRec actually discards the PreviewImage at the end of the file. I will try to work on it.

Re: PhotoRec truncates JPGs from Olympus camera

Posted: 04 Oct 2014, 20:24
by cgrenier
For information, latest PhotoRec 7.0-WIP should recover the PreviewImage as a separated jpg instead of discarding it completely.