Created
April 13, 2020 15:00
-
-
Save Amooti73/e88f105009c48081472dec8089abaf99 to your computer and use it in GitHub Desktop.
Script to extract text from a screen area from https://askubuntu.com/questions/280475/how-can-instantaneously-extract-text-from-a-screen-area-using-ocr-tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Dependencies: tesseract-ocr imagemagick scrot xsel | |
SCR_IMG=`mktemp` | |
trap "rm $SCR_IMG*" EXIT | |
/usr/bin/scrot -s $SCR_IMG.png | |
/usr/bin/mogrify -modulate 100,0 -resize 400% $SCR_IMG.png #should increase detection rate | |
/usr/bin/tesseract $SCR_IMG.png $SCR_IMG &> /dev/null | |
cat $SCR_IMG.txt | /usr/bin/xsel -bi | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not my own work, but from the above post. I have found it very useful and now adapted it for some other scripts.