Repairing corrupt RAW files
Repair of corrupt RAW files is difficult due to various reasons:
- They’re proprietary formats. Although many RAW photos internally are organized similar to TIFF files, they’re modified TIF files. Also actual image data encoding is different from format to format.
- Because they’re proprietary formats, there’s not much software (if any?) to repair them. A software author would have to research each and every separate RAW file type to add support to any kind of repair utility. It may be hard for this to become cost effective, IOW how many licenses of the software can he sell. A low potential volume would result in high prices for a single license, making it less likely someone will buy the software.
- RAW files are large, much larger than the embedded JPEG so there’s a higher chance of something getting corrupted. It is why it is often possible to recover the embedded JPEG intact, even from a severely corrupt RAW photo.
RAW + JPEG setting
Many camera’s offer the option to shoot RAW+JPEG. This option has nothing to do with the embedded JPEG. The preview JPEG embedded in the RAW is often default and part of the specification of the RAW file. So it is there even if you shoot RAW only. If you shot RAW only, the embedded JPEG preview may very well be the only option you have to ever see the photo again.
Recover embedded JPEGs from RAW – Expected quality.
So then next question is, how good is that JPEG? What will be the resolution and what will be the quality?
In my experience most RAW formats embed a full resolution JPEG and a thumbnail size one. In addition some formats also include a medium size JPEG (so then three in total). A few embed a thumbnail and medium size JPEG. So what I see is:
- Thumbnail + full size JPEG
- Thumbnail + medium + full size JPEG
- Thumbnail ) medium size JPEG
Side note: Many photo repair type tools fail the full size JPEG in case a medium size is also available (examples Stellar repair for Photo and Kernel Photo Repair).
It goes without saying with that medium size previews you lose data and therefor quality. The same is true for full size previews as there is no way a file of a few MB (the embedded preview) can compete with often 20+ MB of image data of the RAW file.
Remaining question could then be, how does the quality of the embedded full resolution JPEG compare to the JPEG that is created when shooting RAW+JPEG: This is as far as I know always lower. The embedded JPEG uses higher (lossy) compression than the separate JPEG that is created when shooting RAW+JPEG. Higher compression = lower quality as this compression is achieved by discarding data (hence, lossy).
Using ImageMagick‘s identify command to look at the quality of the JPEG resulting from the camera’s RAW+JPEG mode, you may see 95. When you use ImageMagick to look at the JPEG preview that has been directly extracted from the RAW part of the same RAW+JPEG photo, you may instead see 81.
So any JPEG will always lose from RAW, while the embedded JPEG will lose from the separately saved JPEGs when we compare quality. Note that this difference in quality between the JPEG preview and the separate JPEG may be hard to spot for the human eye.