Page 1 of 1

Despeckling B&W Image?

Posted: 2015-10-08T22:52:52-07:00
by smegmar
Hello, I have scans from several books that are 600ppi B&W images. Sometimes the scanner picks up 1x1 pixels of black on the pages, and also 1x1 pixels of white within printed letters.

I would like to "despeckle" the images so the 1x1 pixels are filled to the color of their surrounding pixels. I have tried using the -despeckle operation with "convert," but it seems that this operation was meant for low-contrast spots rather than isolated black and white images.

Any ideas about how this could be done with convert? I still need to keep the shape of the letters in good order, so I don't want to distort them in the process with any radical changes...

And thank you for any replies, in advance.

Re: Despeckling B&W Image?

Posted: 2015-10-09T01:19:53-07:00
by snibgo
A sample image would be helpful. The solution is probably "-morphology erode" to remove the white pixels, and "-morphology dilate" to remove the black pixels.

Re: Despeckling B&W Image?

Posted: 2015-10-09T09:58:34-07:00
by fmw42
There is also a morphology smooth that does both and open and a close