I have a large number of scans made with the same scanner. After noticing that there are a few consistent specs of dust on the images, I made a scan of the dust hoping to somehow remove the dust from the images, but I couldn't figure it out. Is there a way I can use ImageMagick (or similar scriptable utility that works on Linux) to use the scan of dust to (script-magically) remove the dust from the rest of the images?
1 Answer
Dust removal using a dust mask can be done with G'MIC with the "Inpaint [Multi-Scale]" filter. The easiest way to use G'MIC is as a plugin for GIMP, Krita, or Paint.NET. However, it is available as a command-line utility.
Convert the dust image into a bitmap with pure red and white (or transparent) pixels. (G'MIC uses pure Red as the default mask color.)
Use ImageMagick to overlay the dust map over the original image. (Make sure they are aligned first. This step may be unnecessary if G'MIC is able to take the mask as input directly.)
Call G'MIC with the "Inpaint [Multi-Scale]" filter. (Look up usage in the command reference.)
Repeat with each image.
-
\$\begingroup\$ Thanks for the answer! I'll look into it. \$\endgroup\$ Commented May 22, 2019 at 13:33
-
1\$\begingroup\$ Hope you find what you're looking for. \$\endgroup\$– xiotaCommented May 22, 2019 at 13:44