commit 8221e5a53332abf3c72031b70d66fa4481f81eb6 Author: Jean-Marie Mineau Date: Wed Oct 27 23:08:39 2021 +0200 add script diff --git a/README.md b/README.md new file mode 100644 index 0000000..c489fb6 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# Screen to text + +Take a screen shot, run OCR on it, and put the result to the clipboard + +Dependencies: + - spectacle + - tesseract + - xclip (for X, wayland might need more configuration) + +``` +sudo pacman -S spectacle tesseract tesseract-data-fra tesseract-data-eng tesseract-data-osd xclip +``` diff --git a/screen_to_text.sh b/screen_to_text.sh new file mode 100644 index 0000000..0851389 --- /dev/null +++ b/screen_to_text.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +# Take a screen shot, run OCR on it, and put the result to the clipboard +# +# Dependencies: +# - spectacle +# - tesseract +# - xclip (for X, wayland might need more configuration) +# +# `sudo pacman -S spectacle tesseract tesseract-data-fra tesseract-data-eng tesseract-data-osd xclip` + +TESS_LANG='fra+eng+osd' + +file='/tmp/img_'`head --bytes=20 /dev/urandom | md5sum | head --bytes=20`'.png' +/sbin/spectacle --region --background --nonotify --output "$file" +/sbin/tesseract "$file" - -l "$TESS_LANG" | /sbin/xclip -in -selection clipboard