How to remove scanner defects in images

Hello- The glass on my scanner has a few scratches and other defects that appear in all my image scans and I spend a lot of time fixing them with the clone tool. Instead, is there a way to make a ‘blank’ scan (of only the image glass) and then remove that image with the defects from all the ‘real’ images I scan? Can the defects be replaced with black pixels? I am just a beginner/novice with Gimp. Thanks much. sk

The technique I mention here comes from Pat David who has an excellent video on YouTube that details the following in a video about old image restoration (GIMP Image Fixup Walkthrough - YouTube).

Succinctly, Pat David does the following:

  1. Use Wavelet Decompose to break the image up into levels of DETAIL, from large to fine.
  2. Duplicate the detail layer
  3. Use Color Level to significantly emphasize the detail which reveals the flaws
  4. Use a brush to paint over flaws (at each detail level, one at a time, the next few steps repeated at each detail level)
  5. Use Select By Color to select all of the painted places
  6. Shift to the “real” detail level
  7. Use Heal Selection to essentially remove the flaws on that detail layer
  8. Recombine the fixed details/residual with New Layer from Visible

What I’m proposing is that you use Wavelet Decompose (or G’MIC’s Split Details [Wavelets]) to get the details of the scan of the scanner glass, then follow the steps above to create a mask of the flaws. The Select by Color tool essentially creates a ‘copy’ of the flaws you can then past into a new image. This image can be saved and reopened, then you can again use the Select by Color tool to create a selection that is where the glass flaws are. One that’s done, you can use Heal by Selection to wipe out the flaws (or get close to it).

See if what I’ve said makes sense after viewing Pat David’s YT video.

1 Like

Thanks for taking the time to reply to my message. This is complicated, maybe beyond my present ability. I’ll work on it. When I went to the link YouTube also gave me some suggestions for other Gimp YouTubes that seem very helpful for me to learn other techniques. thank you.

Easiest way to learn GIMP is at the feet of experts like Pat David who is one of the best! Watch and rewatch that video. I found it looking for ways to improve old family photos. But the techniques can be applied to other uses.

In your case, you need an image file that contains information about the scratches on your scanner glass. One way is to use that Wavelet Decompose technique Pat David shows … Wavelet Decompose can show those defects in the detail layers it creates. You only need follow his steps up to the “drawing over the defects” step and then Select By Color. You then have a selection that represents the defects for one of the detail layers (you only need to use one of them, I’d use the most fine detail layer). Edit > Copy that selection, Edit > Paste As New Image and you have an image file with that information which you can save, e.g. ScannerGlassDefects.png.

In the future with new scans, you do the following:

  1. Open the new scan

  2. Open this ScannerGlassDefects.png image

  3. Select By Color in it to get a selection

  4. Shift to the new scanned image

  5. Edit > Paste as New Layer

  6. Select by Color on this new layer and you now have a selection for the new image that corresponds to the glass defects saved in the ScannerGlassDefects.png image file

  7. Delete this new layer because you only needed it to get the Selection

  8. Use Heal Selection to remove the defects (as Pat David’s video shows)

Pat David is a treasure!

Hope this helps.

1 Like

It might not be expensive to replace the glass in the scanner. Or to get a replacement scanner. It depends o how much you value your time.

1 Like

Indeed, yes.
As a matter of fact, you’re near a good cleaning solution.
Make a scan without anything in the scan, save this image as “scratches-patron.png” make it black and white and use it to select the defect on a scanned image.

Please provide an example of a scanned image, as well as a scan without image, this would b easier for us to develop with screenshot instead of writing pamphlet that you won’t understand :wink:

1 Like

Thanks everyone for their comments. I don’t know why I didn’t think of this before, but thanks to barefootliam I’ve decided to get a new scanner. Hopefully that will solve my beginner Gimp problems. I’ve found lots of very useful Gimp Youtubes, and other Gimp info thanks to this group. Cheers.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.