PhotoRec truncates JPGs from Olympus camera

Using PhotoRec to recover lost data
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
RfMw
Posts: 1
Joined: 14 Sep 2014, 19:49

PhotoRec truncates JPGs from Olympus camera

#1 Post 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

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: PhotoRec truncates JPGs from Olympus camera

#2 Post by cgrenier »

Can you email me some unmodified jpg from your Olympus camera ?

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: PhotoRec truncates JPGs from Olympus camera

#3 Post by cgrenier »

I confirm the problem: PhotoRec actually discards the PreviewImage at the end of the file. I will try to work on it.

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: PhotoRec truncates JPGs from Olympus camera

#4 Post by cgrenier »

For information, latest PhotoRec 7.0-WIP should recover the PreviewImage as a separated jpg instead of discarding it completely.

Locked