I have 100+ corrupt JPEG files. They were all taken from the same
camera. Each file is approx 3MB, so there must be plenty of data to
work with.
This is an often made, incorrect assumption. As far as we know the file may be filled with zeros. So, to anyone reading this in the future:
Spot check some of the files using a hex editor, HxD is free. Verify the files are not filled with zeros of some repeating byte pattern (FF FF FF etc.). I often get sent JPEGs for repair, and I estimate files are zero-filled in at least 50% of cases.
If this is actually what you see, nothing can repair the files. If it's not the file may be repairable.
If and how depends and I'll explain using software I use and wrote, JPEG-Repair to repair JPEGs. If I know of a free tool that can be tried for a certain repair I will mention that too! I will refrain from linking to my own software.
Basically JPEG is a set of sections, some of which we could consider meta data and one, the largest the actual image data. Each section starts with a 'marker' which tells the purpose of the section and it's size. Exception is the section that contains the image data, it's size is not defined, it should be decoded until we reach an end of image marker.
Corrupt or damaged 'header'
Although there may not be officially something that can be called the header, I refer to all section apart from the section containing the actual image data as header. Most likely symptom for a corrupt header is the inability to open the JPEG at all.
Now assume we can not open the JPEG, for example the software tells you "It looks like we don't support this file format". We checked and found the file does contain data, now what can be a next step?
One way to quickly guestimate if the file can be repaired is by looking at 'entropy'. JPEG is high entropy data and we can ask JPEG-Repair to open a file and calculate entropy.
If entropy looks JPEG like JPEG-Repair will display bits/byte value in green, if too high or low the value will be displayed in red. Byte histogram is fairly evenly distributed and all values are represented. For example following histogram shows only half of possible byte values is used and is by definition not a JPEG file:
We can also open file in batch using for example the extract mode and evaluate multiple files. In this case entropy is too low for the file to contain JPEG data:
If entropy looks good we can try header repair by borrowing the header of a known intact file that was shot with the same device.
Corruption that extends into image data
This can be result of ransomware but it can happen for a number of other reasons too. An example is incorrectly recovered photos as demonstrated in the video below. Repair requires a known good reference file. In short we glue header onto the corrupt file and then weed corrupt data. Due to how JPEG is encoded we then need to realign the image and correct color.
This video shows an example repair: https://youtu.be/sSDvNa7HOOA
Corruption in image data
Note you can attempt this type of repair using the free JPEG Repair Shop.
There is no real way to repair corrupt data inside the JPEG stream, we can however remove the corrupt data and replace it with dummy data (zeros for example). Rest damage can often be easily repaired using a photo editor that offer content aware fill.
Here's an example repair: https://youtu.be/A33zn_sgm30
FF
bytes — i.e., there's nothing there to recover. Have you tried looking at your files with a hex editor, or even Notepad? I suspect that this is a lost cause.JFIF
near the beginning. If the entire file (or even large stretches of it) are all the same character, or even if it exhibits anything that looks like a pattern, then it probably doesn't have recoverable image data.