JPEG Medic // Accurate Manual JPEG Recovery
Table of Contents
  1. Overview
  2. Theory of JPEG Repair
    1. JPEG structure
    2. How to fix broken JPEG file
  3. Working with the Program
    1. Main menu
    2. Virtual folder tree
    3. Files panel
    4. Preview panel
    5. Cluster view
    6. Hex view
  4. Repairing JPEG image
    1. Opening JPEG file
    2. Repair window
      1. Menu commands
    3. Repair procedure
      1. Visual analysis and localization of damaged MCUs
      2. Finding the next correct MCU
      3. Deleting damaged MCUs
      4. Inserting empty MCUs
      5. Color correction
        1. Automatic color correction
        2. Manual color correction
      6. Filling empty MCUs with data
        1. Use the thumbnail image to fill the empty MCUs
        2. Auto-generate missing content
    4. Saving repaired JPEG image
    5. Repairing fragmented JPEG file
    6. Repairing damaged JPEG image based on SOS marker
    7. Repairing JPEG file encoded by ransomware

Finding the next correct MCU

Sometimes, you can easily locate the next correct MCU visually. For example, on this image the next correct MCU is the select block:

Damaged MCU

Note that determining which MCU is a correct one is largely a creative process. For instance, on the above image we can attempt to save the preceding MCU too by selecting it and using the Reload from next/prev bit command (see below).

Damaged MCU

However, if the damages to the JPEG file resulted in JPEG decoder failure, no graphical information below the damaged MCU block will be displayed, so you cannot visually find the next correct MCU.

To find the next correct MCU manually, put the cursor to the last non-empty MCU that you see, and then use one of the following:

  1. Use the Reload from next bit/byte/sector/cluster commands from the Edit MCU menu or use the corresponding buttons in the Repair window.
  2. Manually select the byte to start in the hex dump area by double-clicking it or pressing Enter.

Regardless of the way you selected the next correct MCU, the program will use it as a reference point to find the next correct MCU.

If the selected value does not allow decoding the next five MCUs, JpegMedic moves one bit forward and attempts to decode again. If after scanning 1 MB of data a chain of 5 correctly decoded MCUs is not found, the search stops and you will need to select another correct MCU using one of the above methods.

When the damaged fragment is located, you should delete the corresponding MCUs to make the image look correctly again (minus the damaged part).