Page 1 of 1

Removing spots below certain dimension in BW image

Posted: 2016-05-11T12:03:30-07:00
by Erik
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 am new to IM.

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.

Re: Removing spots below certain dimension in BW image

Posted: 2016-05-11T12:14:18-07:00
by fmw42
What platform?

Best if you post an example image to some free hosting service such as dropbox.com and put the URL here, so we can see what you are describing and test with your image.

Re: Removing spots below certain dimension in BW image

Posted: 2016-05-11T12:50:12-07:00
by snibgo
I would refer you to a recent thread with a similar problem: viewtopic.php?f=1&t=29571

But it's a near-identical problem. And you, Erik, started it, apparently satisfied with the answer.

What's going on?