Skip to content

Instantly share code, notes, and snippets.

@seidler2547
Created November 5, 2012 10:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seidler2547/4016486 to your computer and use it in GitHub Desktop.
Save seidler2547/4016486 to your computer and use it in GitHub Desktop.
Bring back the 90s - Babelfish-style on-screen OCR
#!/bin/bash
# needs:
# - bash
# - xfce4-screenshooter
# - zenity
# - ImageMagick
# - Tesseract OCR (include the languages you want)
[ "$1" ] || exec xfce4-screenshooter -r -o $0
TI=`mktemp`
{ echo 0
convert -resize 2000% -filter Welsh "$1" $TI 1>&2 > /dev/null
echo 50
tesseract $TI $TI -l 'eng+deu+fra' 1>&2 > /dev/null
echo 100
} | if zenity --progress --auto-close
then
zenity --text-info < $TI.txt
else
for i in `pgrep -P $$` ; do pkill -P $i ; done
pkill -P $$
fi
rm -f $TI $TI.txt "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment