Capture2Text - Alternative (Capture text from Screen Directly) in Ubuntu Mate
You don't need "scrot". Imagemagick (which provided "mogrify") can do the job of screen capture. You also don't need to save an intermediate image, as "tesseract" can accept an image on standard input.
As such the above simplifies to...
convert x: -modulate 100,0 -resize 400% -set density 300 png:- |
tesseract stdin stdout | xsel -bi
However I also added the following to my version of the script, to pop up the text on screen so you can check it.
xsel -po | xless - &
Of course tesseract could use some improvements for some fonts! For example 'f's in some fonts have a small hook that makes tesseract think they are 'P's! Arrghhhh...
EDIT: Full script I use is located at...
https://antofthy.gitlab.io/software/#capture_ocr
I link this to a 'hotkey' (Meta-Print) using my window manager (openbox), so I can use it at any time.
If you can't use a hotkey, and need to uncover the part of the screen containing the text you can always launch it with a delay...
sleep 5; capture_ocr
Enjoy
I had to tweek @anthony 's script so it would work on my box (Kubuntu 18.04):
Instead of the convert
line, I used:
import -resize 300% +dither png:- |
Also, I removed the trailing minus -
sign from the last line, so:
xsel -ob | $XPAGER
Working great.