Skip to content

Instantly share code, notes, and snippets.

@lens0021
Created February 26, 2021 03:21
Show Gist options
  • Save lens0021/9e331f3b908ada8c2e4bec045e1cdc30 to your computer and use it in GitHub Desktop.
Save lens0021/9e331f3b908ada8c2e4bec045e1cdc30 to your computer and use it in GitHub Desktop.
screen-ts
#!/bin/bash
# Dependencies: tesseract-ocr imagemagick scrot
SCR_IMG=$(mktemp)
trap 'rm "$SCR_IMG"*' EXIT
scrot -s "${SCR_IMG}".png -q 100
# increase quality with option -q from default 75 to 100
mogrify -modulate 100,0 -resize 400% "${SCR_IMG}".png
# should increase detection rate
tesseract "${SCR_IMG}".png "${SCR_IMG}" -l jpn_vert &> /dev/null
cat "${SCR_IMG}.txt"
xsel -bi < "${SCR_IMG}.txt"
# zenity --info --text="$(cat "${SCR_IMG}.txt")"
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment