From 8221e5a53332abf3c72031b70d66fa4481f81eb6 Mon Sep 17 00:00:00 2001 From: Jean-Marie Mineau Date: Wed, 27 Oct 2021 23:08:39 +0200 Subject: [PATCH] add script --- README.md | 12 ++++++++++++ screen_to_text.sh | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 README.md create mode 100644 screen_to_text.sh 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