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 1


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.

  1. 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.)

  2. 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.)

  3. Call G'MIC with the "Inpaint [Multi-Scale]" filter. (Look up usage in the command reference.)

  4. Repeat with each image.

  • \$\begingroup\$ Thanks for the answer! I'll look into it. \$\endgroup\$
    – Avamander
    May 22, 2019 at 13:33
  • 1
    \$\begingroup\$ Hope you find what you're looking for. \$\endgroup\$
    – xiota
    May 22, 2019 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.