I often receive scanned documents that has dots and grains in them. I often use the paintbrush in gimp to manually remove them, but it occurs to me that all the dots share so many similarities that a simple algorithm should be able to "white" them out automatically.

Take this example: enter image description here

If blacks surrounded by whites in a given area is detected then select that said area for further processing:

enter image description here

Does anybody know of any scripting-way or plugin that can do such a thing?


1 Answer 1


There's a filter in the G'MIC plugin that could be used to get rid of the majority of the dots, although some larger ones may be left behind. It's located under Filters > G'MIC > Repair > Descpeckle

Before and After

enter image description here

  • Thanks so much. The "Repair Scanned Document" filter is just pure magic. I'll definitely support the G'MIC makers financially in the future for gifting their work of art. Feb 2 at 14:12

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