JPEG-Repair Manual | Diagnostics of corrupted JPEG files

<< Back

Condition of a file

Not all JPEG files can be repaired. In fact I see that a lot unfortunately. JPEG-Repair does several analysis on each file it processes that may help you determine why a file can not be repaired.

JPEG data has certain properties due to the fact that it is encoded and compressed. For example, all byte values are used/present in a JPEG, unlike for example a text document. Also, due to compression the file data has high entropy (chaotic, unpredictable). Assume following uncompressed data: AAAAAABBAACAAAABCCCAAAA = 23 characters. Let’s try compress this using the simplest method I can come up with right now: 6A2B2AC4AB3C4A = 14 characters. Instead of writing out 6 A’s, we simply indicate by 6A that uncompressed data contains AAAAAA. Followed by 2 * B, 2 * A, C, 4 * A etc.. When we compare the compressed and the uncompressed data we see uncompressed data is less random and less predictable. Compressed data appears more random. Cutting corners here, but you could call that higher entropy. And this is sort of what we see in JPEG files as well.

JPEG-Repair shows entropy and a byte histogram

Entropy in a JPEG file is somewhere around 7.6 – 7.9 bits per byte. A tad higher? Then the data is probably encrypted which is what I see a lot with JPEGs copied from Android devices such as smart-phones. In that case the file can not be repaired. The byte histogram shows you occurrence of bytes with specific values. Above shows a quite normal JPEG. Note that the zero value (blue bar on the left) is highest, this is common for JPEG files. Below are examples of files that are beyond repair:

 Only lower half of byte values used, probably other file format. So, this NOT mean only half the file is filled. There are simply only byte values found in range 0 – 128.

 File is filled with zeros, see blue bar on left. This file can of course not be repaired. Often caused by fake memory card.

 File is filled with a pattern, see bar at right, value 255 (equals FF in hex). Can be symptom of files being saved to a fake memory card.

It is also possible to simply inspect the file visually, click the right button under tools to open a hex viewer.
 
Only half the image because data is missing

Only half the image because data is missing. At some point if file there are only zeros.