Removing spots below certain dimension in BW image
Posted: 2016-05-11T12:03:30-07:00
I am new to IM.Version: ImageMagick 6.9.4-1 Q8 x86_64 2016-05-11 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib freetype jng jp2 jpeg lcms ltdl lzma png webp wmf xml zlib
I have BW image of a scanned text. There are remaining black spots, much smaller than the text.
Is there a way to remove a cluster of black pixels, surrounded by white pixels? I looked at morphology, but I have trouble achieving the effect. With cluster, I mean a connected area of black pixels.
Something to the effect of:
Code: Select all
-fill white -cluster 10x10 -opaque black
Where cluster contains at least one black pixel, has a maximum dimension of 10x10 (thus may hold up to 10x10 black pixels), and the outer edge of the cluster is white.