Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I posted this question the other day: Suggestions on how to repair corrupt files

The files I used in example were perhaps not the best. These are still ever so slightly NSFW, but I now have two files that I feel are better for figuring out how to solve this.

An archive of two files, one good and one bad can be downloaded from here:

Here is some basic data: (identical in size)

-rw-r--r--+  1 me  staff   1935797 May 26  2009 bad.JPG
-rw-r--r--+  1 me  staff   1935797 May 26  2009 good.JPG

MD5 does in fact differ:

MD5 (bad.JPG) = 313356d98ced569d573b9ded1555cf2b
MD5 (good.JPG) = e6178e88e92a79e97b6f9babe7dd8240

If I hexdump each file, the bad file has less data in it, but I am not sure if it is repairable or not. Perhaps just header data is missing and I can add it back in, perhaps there is real data completely unlike meta data that means these and similar files are completely busted.


share|improve this question
up vote 5 down vote accepted

Looking at your ZIP file tells the story. good.jpg and bad.jpg are the same file size but bad.jpg compresses from 1.84MB down to 1.03MB whereas good.jgp is almost uncompressable. This indicates that a large portion of bad.jpg has been overwritten with other data that is easily compressible. So a large portion of the image data (DCT coefficients quantised and then compressed) is completely unrecoverable, even if you could reconstruct the header information.

share|improve this answer
Thanks, perfect. – user17245 May 22 '11 at 8:37

You can use a hex-editor to view the raw binary data in the files. You can also use a differencing tool to view the differences between the files.

In this case, bad.jpg is missing the first 851,968 bytes of the photo (they are NULLs), so no, it’s not possible to repair the photo, though you may be able to attempt to recover as much of it as possible. Calvin Hass has some interesting information on corrupt photos.

(And for the record, you may want to be careful about posting raw, unmodified photos directly from the camera to the Internet; the Exif data could contain some information that you may not want leaked—not usually an issue, but you never know.)

share|improve this answer

actually what you did to compress the two file has already shown the differences between the two files -

good.jpg compresses by 1% (typical of jpeg image) bad.jpg compresses by 44% (not typical of jpeg image)

thus it is very likely that most data have been lost. (okay, at least 44%)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .