Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selecting Large Amount of Small Specks
#1
I have several hundred scanned pages I received as 1-bit images. The person that scanned them left a LOT of specks 1 to 10 pixels in diameter. To manually remove them will take weeks. Is there a script that will select all the specks and change them to background color and then save them as the same file name?

The text is rather bumpy, but I doubt there is anything that can be done with that.

Thanks Sandy


   
Reply
#2
  • Select the background color
  • Select>Grow by one pixel
  • Select>Shrink by one pixel
  • [Delete]
Reply
#3
Are you really using Gimp 2.8 ?

Quote:I have several hundred scanned pages I received as 1-bit images. The person that scanned them left a LOT of specks 1 to 10 pixels in diameter.

More than just a remove-speckle problem. Several hundred scans and 1 bit (black / white) images.

Several hundred, and the usual advice from the clever guys is "write a script" and apply in a batch file.

I am not that clever so I will use two Gimp plug-ins gimp-gmic to improve the scan  http://www.gmic.eu and BIMP  https://alessandrofrancesconi.it/projects/bimp/ for "several hundred" Both come with Windows installers.

Individually the workflow is 
convert the image to grayscale (for gmic)
apply the gmic repair scanned document filter.

I have gone a little step further and used a script to quickly apply the gmic filter. Attached gmic_shell.zip Unzip put gmic_shell.scm in C:\Users\"yourname"\.gimp-2.8\scripts

Then for several hundred apply that procedure using the plugin BIMP. 

The whole thing in 3 minutes https://youtu.be/hVE6pJXjF74





edit: add a pre-despeckle to the script for large speckles.


Attached Files
.zip   gmic_shell.zip (Size: 716 bytes / Downloads: 10)
Reply
#4
Rich2005, in your workflow you can also use (just a suggestion) :

- Filters / Blur / Gaussian Blur (value 4 - I dont know if one can change that in a batch ?)
- Filters / GMic-Qt / Black & White / Stamp

Result :

     
Reply
#5
On Gimp 2.10, Filter>Blur>Median blur (with a small radius: 1 or 2px) is worth a try.
Reply
#6
Thanks All. I'm doing other things to each page, some color highlighting, underlining, etc., so batch editing won't be a big help.

Ofnuts, your Grow 1 pixel, Shrink 1 pixel, Delete works fine for my purpose. Looks good printed on my printer. Thanks

I'm using Gimp 2.8

How would I create a script or plugin in to do all of the following after I make background selection?


Select>Grow by one pixel
Select>Shrink by one pixel
[Delete]
Select>None
Image>Flatten Image
Image>Center Guides
Image>Mode>RGB
Reply
#7
A small script. Adds a Gimpy222 menu to your image menubar. Several entries, for 1 to 5 pixels of grow-shrink.

I suggest you try a few values on the a first couple of images, then either you use Ctrl-F to replay the same filter all along, or you set a keyboard shortcut for the one you use often (seach for "gimpy222").

Have a look at my  ofn-file-next script to go from one image to the next if mass-editing.


Attached Files
.zip   gimpy222-nodots.zip (Size: 872 bytes / Downloads: 12)
Reply
#8
[quote pid='16976' dateline='1582375566']
denzjos Wrote:Rich2005, in your workflow you can also use (just a suggestion) :

- Filters / Blur / Gaussian Blur (value 4 - I dont know if one can change that in a batch ?)
- Filters / GMic-Qt / Black & White / Stamp

Result :

These two steps worked great.  Thanks, denzjos.  I couldn't do anything with grow1, shrink1, delete, it just didn't seem to have any effect for me.  
 
[/quote]
Reply
#9
(02-24-2020, 04:06 PM)Ofnuts Wrote: A small script. Adds a Gimpy222 menu to your image menubar. Several entries, for 1 to 5 pixels of grow-shrink.

I suggest you try a few values on the a first couple of images, then either you use Ctrl-F to replay the same filter all along, or you set a keyboard shortcut for the one you use often (seach for "gimpy222").

Have a look at my  ofn-file-next script to go from one image to the next if mass-editing.

Perfect! Excellent! Thank you very much!
Reply


Forum Jump: