Skip to content

Instantly share code, notes, and snippets.

@sordina
Last active September 17, 2018 06:09
Show Gist options
  • Save sordina/8429797 to your computer and use it in GitHub Desktop.
Save sordina/8429797 to your computer and use it in GitHub Desktop.
Wrapper script for tesseract to output to STDOUT.
#!/bin/sh
if [ ! "$1" ]
then
echo "Usage: ocr <image-file>"
exit
fi
if [ "x$1" = "x-h" ]
then
echo "Usage: ocr <image-file>"
echo
cat <<EOF
Example:
| user@host ~ ocr shot.png
| (amen
| Nodes: 59719
|
| (ages: 174370
| Undlveued Graph
EOF
exit
fi
BASE=/tmp/tesseracttemp_$$
PIPE=$BASE.txt
rm -f $PIPE
mkfifo $PIPE
tesseract "$@" $BASE &
cat $PIPE
rm -f $PIPE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment