For my JPEG Repair Service I am often asked to repair JPEGs that only partially display. The bottom half of JPEG is missing or greyed out, solid grey. I some times can repair this and I some times can not. It all depends on if there is data present I can work with. Fact is that the image partially shows, so the header is intact. The problem is likely to be within the image bit stream.
Missing data – Bottom half of JPEG is missing
Option 1, file too small.
It’s a good idea to first compare file size for the corrupt file with the size of similar intact files. If an intact file for a given resolution with a similar subject is considerably larger than the corrupt file, then you’re simply missing part of the data. Such a file can not be repaired. If the file is a result of a data recovery it sometimes pays off to recover the file again using a different method.
Option 2, file’s data overwritten.
The first thing I usually do is open the corrupt JPEG file using a hex editor. A good 95% of the file is filled with seemingly random data if a JPEG file is intact. It is simply compressed data in which it is hard to find any pattern. If random data however turns into zeros or a repeating byte pattern, data is missing and the file can not be fixed.
This type of damage often is due to corruption while file is being written or transferred (from for example memory card to PC). Always check the file content on the original media. If those files are already corrupt then there is probably not much that can be done.
Option 3, corruption in image data.
If however the random data continues until the end of the file (and even ends with FF D9) then it may very well be possible to repair the image as we can tell from the below example:
The hex editor shows data though out the entire file. The last two bytes of the file read FF D9, a correct end marker for a JPEG file. The file was repaired by cleaning up invalid data from the image stream, realigning the image and correcting colors.
To some degree my utility JPG-Repair may be able to fix this.
The top part of the image shows it as I received it. The bottom is after JPG-Repair fixed invalid markers and stripping some of the corrupt data. The repaired JPEG still requires post processing using a photo editor like the freeware Paint.NET.
File size okay? A quick check when bottom half of JPEG is missing
Check yourself, by opening the file using a binary or hex editor. In this video I use HxD. It is free and you can get it here: https://mh-nexus.de/en/hxd/.
The video shows you how to use HxD to quickly check if the file is certain to be beyond repair. The video shows files containing only zeros. It is also possible the files are filled with a repeating patterns. For example ‘FF DD FF DD’ etc.. Or ‘FF FF FF FF’ and so on. Such files can not be repaired, the only similarity with a JPEG file is the JPG file extension. They contain no JPEG markers nor image data.
In case part of the image is actually displaying, you may see the random data turn into a byte pattern.