add script
This commit is contained in:
commit
8221e5a533
2 changed files with 28 additions and 0 deletions
12
README.md
Normal file
12
README.md
Normal file
|
@ -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
|
||||||
|
```
|
16
screen_to_text.sh
Normal file
16
screen_to_text.sh
Normal file
|
@ -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
|
Loading…
Reference in a new issue