summaryrefslogtreecommitdiff
path: root/ocr_screen
diff options
context:
space:
mode:
authorAnton Bobov <abobov@gmail.com>2020-02-06 13:45:24 +0500
committerAnton Bobov <abobov@gmail.com>2020-02-08 23:35:07 +0500
commitd5c22685624a4c4e4ac039a5c23782245f95385b (patch)
tree11e17e1070549cfdfeaacea7593729b822efd893 /ocr_screen
parent69c820a66463a0416ff6fc230644f40d912a3cbd (diff)
Update.
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