Background removal and cleanup of book scan

@shreedhar does answer your question excellent.

Maybe I’m more clumsy. I push the OK-button after a filter. Then I view the result in GIMP, because the end result is sometimes different from the preview. In this case I continue with the last result and restart G’MIC for the next filter.

@afre made a nice filter yesterday/today :+1::

GIMP>G’MIC>Testing>Afre>Clean Text

Maybe you can try that filter also:


1. I have changed the category to Processing and added the tags gmic, rawtherapee, scanner. I think we have room to discuss how to make better scans.


2. iarga is correct. Clean Text is available as a GIMP-G’MIC plugin filter and also as a CLI command (afre_cleantext). Unfortunately, I am having trouble retrieving it from the servers. I don’t know if you have the same issue ATM when you try updating the filters. Do the following:

For GUI plugin

gmic-afre

Then search for Clean Text.


For CLI

gmic update
gmic sample tiger afre_cleantext

3. You can totally do batch work using the GUI or CLI. Try the filter on the two most different scans and find a happy medium.

Then in GIMP, Open as layers..., in the plugin, set Input layers as All, and then you could apply the filter to all of the pages.

Or in CLI, you could copy all of the scans to a single new folder and do

gmic input_glob *.jpg repeat $! local[$>] afre_cleantext , o _{b}.jpg endlocal done

Hint: replace the comma with your parameters. The comma by itself means that it will use the default values I have set.


PS If you found my filter and instructions helpful, perhaps we could as a community write a tutorial together, with instructions on how to digitize a book. I don’t have the time for that currently but what do you think @patdavid @paperdigits?

2 Likes

Anyone is free to contribute an article! I can help with the copy editing and all the git stuff if you’re not inclined.

Our git repo for the main website is public: GitHub - pixlsus/website: The PIXLS.US website

1 Like

Unfortunately i can not download afre’s filter :frowning:

Is it possible to load it somewhere else?
Later, Peter

You may need to hit the refresh button a few times.

I did so.
I will do again 20 times.
Later, Pit

What does that mean?

From 20 attempts i get 5 x time out error.

Yesterday I had a few times the same error. This doesn’t help you, but now you know that you are not doing anything wrong. Maybe this has something to do with the G’MIC server?

Try installing the latest prerelease of G’MIC.

https://gmic.eu/files/prerelease/

After installing this prerelease, hit the refresh button.

Now i downloaded the prerelease-file. In the About → Download External Data there is the information that i have to copy the decompressed files to
user\appdata\GMIC.

I found the directory
…\appdata\Roaming\GMIC
May i kindly ask if this is the correct directory for to get the prerelease working as a plugin in GIMP?
Well, the content of the directory (left side) is quite different than the content of the decompressed Zip-File (right side).
Sorry for this Newbee-Question.
Thank you very much!
Later, Pit

That doesn’t look right. Download:

https://gmic.eu/files/prerelease/gmic_gimp2.10_qt_win64.exe or
https://gmic.eu/files/prerelease/gmic_gimp2.10_qt_win64.zip


PS
– I downloaded the *.zip file.
– Searched for all of the gmic*.exe files and found the folder with the plugin version.
– Backed up those files.
– Extracted the zip into the folder.
– Renamed gmic_gimp_qt.exe to whatever the original file was called (mine was gmic-qt.exe).
– Restart GIMP if it is open.

I followed your instruction with success. Juhu - and the result is incredible!!
Best scan processing ever!!
I worked out that with 0,44 - 90 - 90 the image is softened and very good. But
0,33 - 96 - 97 i get the best results. WEith 0,34 - 96 - 97 it is smoother. If i change the second slider just to 97 the whole page is black. The filter works wonderful.

There is only one thing (which has nothing to do with your filter) left. The preview is now in someway compressed.


What has happened there with the prerelease?
I now will go to work with the batch.

Thank you so much for this filter.
Later,
Pit

1 Like

You are very welcome. As you can see, I love to help people.

3 Likes

Update: done, released!


Might release an improved afre_cleantext.

Released version

Proposed version


Pull version (full page)

3 Likes

Great results!!
How to load this “new” version?

Thank you very much for your work. Incredible!
Later, Pit

Using the same information as above. Update or download the files.


Is that Mk2 of your great filter? In the copyright there is only afre, 2019 shown.
Later, Pit

The update filter button worked for me. Clean Text now has 4 sliders.

@Pit-Lip definitely there so keep refreshing list, wasn’t there for me last night but it’s there now.

Yes, now everything is there. Perfect!
Pit

One can improve further with high pass filter in overlay mode (sharpening) and final desaturation to remove any yellowish color trace.