Created
May 10, 2022 15:03
-
-
Save Dimfred/189e0e695bf4f96dcd761147ca92113b to your computer and use it in GitHub Desktop.
Text from screenshot with tesseract
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
#!/usr/bin/env sh | |
main() { | |
# path to store tmp stuff | |
dir=/tmp | |
# tmp path of the img to process by tesseract | |
out_img=$dir/tesseract_img.png | |
# output text read from the img | |
out_txt=$dir/tesseract_text | |
# make a screenshot from selection | |
maim -s $out_img | |
# detect | |
tesseract $out_img $out_txt | |
# read the text | |
cat $out_txt.txt | xclip -selection clipboard | |
} | |
main $@ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment