Skip to content

Instantly share code, notes, and snippets.

@HairyFotr
Last active December 11, 2015 10:38
Show Gist options
  • Save HairyFotr/4588073 to your computer and use it in GitHub Desktop.
Save HairyFotr/4588073 to your computer and use it in GitHub Desktop.
readMeme
#usage: readMeme [IMAGE URL or FILE]
#dependencies: wget imagemagick cuneiform
readMeme() {
pic="`mktemp`"
txt="`mktemp`"
in="$1"
if [[ $in == http:* ]] || [[ $in == https:* ]]; then wget -q -O $pic $1; else cp $1 $pic; fi
mogrify -resize '640x640>' -negate -sigmoidal-contrast 14x12% -scale 115%x102% -threshold 24% -background gray0 -deskew 9% -threshold 47% $pic &&
cuneiform $pic -o $txt &> /dev/null &&
cat $txt | grep -o '[a-zA-Z0-9,.! ]*' | tr '\r\n' ' ' && echo
rm $pic
rm $txt
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment