First things first, what is repair and what is recovery?
Corrupt JPEG file Repair and JPEG File Recovery are often mixed up.
- Recovery: Meaning getting lost or deleted files back from for example a memory card. Maybe the card itself (the file system) is corrupt or the card was accidentally formatted.
- Repair: Repair existing JPEG files that can not be opened in image viewing or image editing software, or that appear to be corrupt when viewing them (colors off, shifted pixels etc.). You can see the file in the Windows Explorer but there is something wrong with the file itself.
• Images split into two or more parts
• Images appear blurred or distorted
• Change in colour pattern
• Change in the shift or structure of the image
• Pixelated version of the images
• No preview available
We speak of recovery when you need to get access to files that are no longer visible in the file system. They were deleted, wiped from a formatted drive or otherwise lost.
For this you typically use Photo or Digital Image Recovery software. This is a ‘specialized’ software. But you might as well use standard file recovery or undelete software. Photo Recovery tools are often (but not always) either ‘dumbed-down’ generic file recovery tools or RAW scanners. The latter are also known as ‘carvers’ or ‘carving software’.
By dumbed down generic file recovery or undelete tools I mean that it is a generic file recovery tool. However the manufacturer simply limits the software so it only recovers certain files, like digital images.
It is confusing that many companies selling recovery software will use terms like ‘recover corrupt JPEG files’, suggesting that their software can somehow fix corrupt JPEG and other files.
In fact, most undelete and photo recovery tools can not handle fragmented files. Thus files that were perfectly intact before deletion will be corrupt after recovery if they were fragmented.
Corrupt JPEG files are the files you can actually see in Windows explorer, but there is a problem opening them in a photo viewer. So, the files are not deleted or otherwise lost. The photo viewer may simply be unable to open the file at all. Or it opens the file and shows a distorted image.
This can happen for no apparent reason. Or you may discover errors after transferring files from a memory card to your PC. When transferring files, often a cut & paste operation is applied. This means the files are copied and deleted from the memory card as well. In this case you may want to try if photo recovery software can recover intact files from the memory card. If not, then attempting to repair the images is an option.
What I also see a lot is that JPEG or other digital photos are corrupt after using photo recovery or file recovery software. There are a number of possible causes:
- Photo is actually corrupt (parts missing or overwritten). – Can not be repaired, parts are simply missing.
- Photos were fragmented. – Can not be repaired, parts are simply missing.
- Bad sectors on source medium: One bad sector accounts for 512 bytes missing. Due to the nature of many digital photos, even a single corrupt byte can result in corruption. – Can often be repaired.
Important note regarding undelete and photo recovery software vs fragmented files:
So, I have said that fragmented files can not be recovered by undelete or photo recovery software. Undelete or file recovery software can not due to a limitation of the FAT file system. This is the most widely used file system on memory cards. Photo recovery software can not because it simply looks for the start and end marker of a file. I did a blog post which explains this in more detail here.
I also explained that such files can not be repaired because part of the file is simply missing. So basically this means you’re out of options.
This is however not entirely true! DiskTuna is involved in the development of a unique advanced file carver ‘ called JPEG Recovery LAB‘ that can actually recover fragmented digital photos. So, if your recovered photos loo somewhat like the first example, it may be a good idea to give our tool a try. JPEG Recovery LAB works for JPEG and some popular RAW digital image formats used by cameras.
Repairing corrupt JPEG Files
So,an often heard complaint is that digital photos are corrupt after recovering them using recovery software. This is mostly caused by parts of the file being overwritten, file fragmentation or bad sectors. In this case (JPEG) file repair can be regarded phase 4 data recovery.
But there are plenty of other reasons for corrupt JPEG files. From the moment of taking the picture to the moment the JPEG file is on your PC things can go wrong. Most files I receive for repair were never lost or deleted. They simply became corrupt somewhere, somehow. I did a post on that a while ago.
For repairing corrupt JPEG files you bascially have two options:
- Use JPEG Repair software
- Sent the corrupt JPEGs to a JPEG Repair Service.
First check you can do to determine recoverability.
There is a quick first check you can perform using a hex editor to see if JPEG files can be repaired at all:
I use HxD. You basically want to skim through the file and see if there is data in it. Every now and then I get sent files that are filled with zeros or a byte pattern like FF FF FF FF etc.. If that’s the case then there’s no hope of repairing the file.
While there you may want see if the first two bytes in the file are FF D8 and the last two FF D9 (the header and footer of a JPEG file).
Using JPEG Repair Software
Some time ago ‘Raymond.cc’ discussed a number of JPEG Repair tools. His tests are ‘artificial’ but I can only confirm his results after testing some (Stellar JPEG Repair and HetMan File Repair) of them against real world cases, I get mixed results. Free demo’s are available so it never hurts to try.
For example, I was able to repair this image (the moron in the middle is me, so no need to blur that):
At first glance it looks like typical file fragmentation damage. But apparently it’s not. So, never take things for granted, simply try if the demo version is able to show you an intact file!
Hint for when using JPEG File Repair Software:
JPEG Repair tools may employ multiple methods for repairing your files. One of them is to extract the embedded JPEG preview file. It is a smaller version of the actual image. The software may present this as a successfully repaired image! So check the resolution of the file first. If it is a much lower resolution that the original, it’s the preview. My freeware JpegDigger can extract preview files as well.
The same applies to some of the online JPEG repair services (see below) as well.
Online JPEG File Repair
There are a number of sources online that offer JPEG Repair. Some appear to be automated ‘online applications’:
VG JPEG Repair. They also offer a Windows client. Using the trial I was never able to repair a corrupt JPEG. The ones I tried appeared to be as corrupt as they were before. The only change was that they were now water-marked. Online it showed 7 more images, all slightly different which suggests it has been trying different solutions, one of them being a lower resolution preview.
I also tried the free version of Online PixRecovery and got the same result. The picture marked ‘repaired’ had the same damage as the original.
It appears repairs are done by software. So, the only difference from trying above JPEG Repair tools, is that the software runs on a remote server rather than on your computer.
Manual JPEG Repair Services
Bottom line is that in many cases repair of corrupted or damaged JPEGs can not be automated. They require the human eye, intuition and expertise. This video shows the various stages of repair of a JPEG file that was sent to me. I ran into all kinds of problems I had not seen before. I as a human being can reason my way through that and try alternatives. At this point software can not do that.