I'm wondering if there is a way to recover corrupted JPEG files.

They got corrupted because I deleted a folder for error and I promptly recovered it with a recovery software. Most of the photos are just fine but some of them have problems like

  • grey areas at the bottom
  • color/image shifts of some stripes of the image

I tried by verifying integrity with jpeginfo tool and it actually showed me that these photos had some problems related to the checksum Hauffman bitstream.

Are there any tools around which can try to recover these images? Some of them clearly show that data is still there, just messed up.


This is a long shot, but if your JPEGs happen to be encoded in progressive mode, then you may be able to salvage a lower resolution version of your corrupted picture(s).

Progressive JPEGs are encoded as several incremental "scans". The file begins with a scan that represents the whole image at a very low resolution, each successive scan builds on top of the previous one and adds more resolution. This incremental process continues until the full resolution image is obtained.

In theory, if your JPEGs are progressive you should be able to stop decoding when you find a corrupted scan, and while the image will be lower resolution than the original, at least it will be whole.

I believe the jpeginfo tool your are using will tell you if your jpegs are progressive or baseline, so this would be a quick test to decide if you need to invest more time into this potential solution or not.

Unfortunately I could not find any tool that can dump the incremental resolutions as individual images, this may need a custom tool built around libjpeg.


If the problem is with the huffman (this is the lossless part of the JPEG compression), then your chances of recovering the image information are really minimal. Huffman, like other forms of entropy coding, minimizes information redundancy in the data stream, ideally to the absolute minimum. This means that there are most likely no "other pieces" of the compressed stream that you can use to learn about the nature of the missing or corrupted part.

That said, there may be some tool available of recovering the specific image you have. Otherwise, some manual photo editing, like the example by @mattdm in the question he linked to, my salvage your photo.

Note: interesting read is the first two paragraphs of the abstract of this document.

  • I just wrote a command line tool to analyze the whole library and extract the warning/errors with the aid of jpeginfo. It reported many different issues so I guess I'll study them further. I'm practical of the JPEG format so I could try to see what's recoverable but it would require a lot of time, that's why I asked for a premade tool :) Here's the script for future reference: pastie.org/4039144 (it requires jpeginfo and Groovy) – Jack Jun 6 '12 at 17:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.