Created
June 12, 2020 20:22
-
-
Save maxjf1/b2cc85a8581b15229674c29c8ed57f97 to your computer and use it in GitHub Desktop.
OCR to clipboard script for ubuntu
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 | |
SCR_IMG=`mktemp` | |
trap "rm $SCR_IMG*" EXIT | |
gnome-screenshot -a -f $SCR_IMG.png | |
# increase quality with option -q from default 75 to 100 | |
# Typo "$SCR_IMG.png000" does not continue with same name. | |
tesseract $SCR_IMG.png $SCR_IMG &> /dev/null | |
TEXT=`cat $SCR_IMG.txt | sed -e 's/^[[:space:]]*//'` | |
echo $TEXT | |
cat $SCR_IMG.txt | sed -e 's/^[[:space:]]*//' |xclip -i -selection clipboard | |
notify-send "OCR copiado para clipboard" "$TEXT" | |
rm -r $SCR_IMG.txt $SCR_IMG.png &> /dev/null | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment