Last active
September 17, 2018 06:09
-
-
Save sordina/8429797 to your computer and use it in GitHub Desktop.
Wrapper script for tesseract to output to STDOUT.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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