summaryrefslogtreecommitdiff
path: root/ocr_screen
diff options
context:
space:
mode:
Diffstat (limited to 'ocr_screen')
-rwxr-xr-xocr_screen18
1 files changed, 18 insertions, 0 deletions
diff --git a/ocr_screen b/ocr_screen
new file mode 100755
index 0000000..fc9cb76
--- /dev/null
+++ b/ocr_screen
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+if [ ! -x "$(command -v tesseract)" ] ; then
+ echo "No tesseract executable"
+ exit 1
+fi
+if [ ! -x "$(command -v scrot)" ] ; then
+ echo "No scrot executable"
+ exit 1
+fi
+
+TEMP_FILE=$(mktemp --suffix .png)
+L=${1:-eng}
+trap "rm $TEMP_FILE" EXIT
+
+scrot --select --quality 100 --overwrite "$TEMP_FILE"
+mogrify -modulate 100,0 -resize 400% "$TEMP_FILE"
+tesseract -l $L "$TEMP_FILE" - 2>/dev/null | sed '/ /d' | xclip -sel clip