Comparisons

How to Fix Scratched Photos Online — Tools Compared

By LeoRestorer Editorial9 min read

Scratches are the most common type of photo damage. Chemicals from old album pages, rough handling during moves, and decades of storage in attics leave thin lines across faces and backgrounds. The good news: scratch removal is one problem AI handles well, because the algorithm only needs to fill thin gaps using surrounding texture.

How Scratch Removal Works

The technical term is inpainting. Given an image and a mask (which pixels are damaged), the algorithm fills masked regions using information from nearby pixels.

Traditional methods like OpenCV's cv2.inpaint() use fast marching (Telea, 2004) or fluid dynamics (Navier-Stokes) to propagate surrounding colors into the gap. These work for thin, isolated scratches but produce blurry patches on anything wider than a few pixels.

Deep learning inpainting — LaMa (Suvorov et al., 2022), MAT (Li et al., 2022) — uses neural networks trained on millions of images to generate plausible texture. LaMa in particular handles irregular scratches, large missing regions, and textured areas (hair, fabric, brick walls) much better than classical methods.

Tool Comparison

We tested 5 approaches on a set of 10 scratched photos from the 1940s-1970s. Each photo had 5-20 visible scratches ranging from single-pixel lines to 3-5mm wide damage strips.

ToolTimeCostQuality
OpenCV Telea0.3sFreeThin scratches only. Blurry on wide damage.
Photoshop Content-Aware Fill2-5 min$22.99/moGood but manual. You select each scratch area.
LaMa (via Replicate)1-3s~$0.003/imgBest balance of quality and speed.
IOPaint (self-hosted)1-2sGPU neededSame as LaMa. Free if you have 4GB+ VRAM.
LeoRestorer5-15s$0.25-0.50Automated pipeline. No manual masking needed.

Getting a Scratch Mask

The hardest part of scratch removal is not the inpainting itself — it is finding the scratches. Most tools need a binary mask showing which pixels are damaged.

  • Manual: Photoshop, GIMP, or IOPaint let you paint over scratches. Accurate but slow — expect 5-15 minutes per photo.
  • Automatic: AI restoration services (including LeoRestorer) detect scratches automatically using trained segmentation models. Not perfect — sometimes misses faint scratches or flags texture as damage — but good enough for batch processing.
  • Semi-automatic: Use edge detection (Canny, Sobel) to highlight potential scratches, then manually clean up the mask. A reasonable middle ground for technical users.

Practical Tips

  • Scan at 600+ DPI. Thin scratches are often 1-2 pixels wide at 300 DPI — too thin for reliable detection.
  • Fix scratches before colorizing or upscaling. Running colorization on a scratched photo propagates the damage into color channels.
  • Check faces carefully after scratch removal. AI sometimes fills eye regions with skin texture if a scratch crosses the iris.
  • Save originals. AI results are "good enough" most of the time, but you may want to try a different tool later.

Remove scratches automatically

Upload your scratched photo and let AI detect and fix scratches. 30 free credits (3 free photos) for new accounts.

Try Scratch Repair