Last active
December 11, 2015 10:38
-
-
Save HairyFotr/4588073 to your computer and use it in GitHub Desktop.
readMeme
This file contains 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
#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