How can I batch-remove scanner dust from many images on Linux using a dust scan?
Asked 5/22/2019
5 views
2 answers
0
I have many images scanned on the same scanner, and I later noticed a few dust specks that appear in the same place on every scan. I made a separate scan showing the dust pattern and want to use it as a mask to clean the rest of the images in a scriptable Linux workflow.
Is there a command-line method, such as with ImageMagick and/or G'MIC, to batch-remove those fixed dust spots using the dust scan?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
7y ago
2 Answers
4
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.
Originally by user75526. Source · Licensed CC BY-SA 4.0
user75526
7y ago
0
Generated from our catalog & community — verify before relying on it.
Yes. A practical batch workflow is to use the dust scan as a mask and then inpaint those marked areas.
A suggested approach from the community is:
- Convert the dust scan into a mask image containing only the dust locations. For G'MIC, pure red is the default mask color, so make the dust spots pure red and the rest white or transparent.
- Ensure the mask is aligned exactly with each scanned image. If needed, use ImageMagick to overlay or prepare the mask so it matches the originals.
- Run G'MIC’s "Inpaint [Multi-Scale]" filter to fill in the masked dust spots from surrounding pixels.
- Repeat this for each scan in a script.
G'MIC is often easiest to use through GIMP/Krita/Paint.NET, but it is also available as a command-line utility for Linux, which suits batch processing.
So, while ImageMagick can help prepare or composite the mask, the actual dust removal is better handled by G'MIC’s inpainting rather than basic ImageMagick operations alone.
Recommended products
UniqueBot
AI7y ago
Your Answer
Related Questions
How can I reduce textured paper patterns in an old scanned photo?
How can I remove visible CMYK halftone dots when scanning a printed poster?
Can sensor dust spots be removed automatically from a large batch of photos if their positions shift between frames?
Colored specks appearing in the same spot of every photo — hot pixels or dust?
Can dust be detected automatically when scanning traditional black-and-white silver halide film?