Last active
November 16, 2015 12:04
-
-
Save s4l1h/553d00b71d4ab14c17d9 to your computer and use it in GitHub Desktop.
tinypng.com api bash script | make "old" and "new" directory put files old directory.
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
APIKEY=""; | |
for f in old/*.png | |
do | |
echo "Compressed- $f" | |
OPT=`curl -i --user api:$APIKEY --data-binary @$f https://api.tinypng.com/shrink | sed -ne 's/.*"\(http[^"]*\).*/\1/p'` | |
echo $OPT | |
ORG_FILE=`sed "s/old\///g" <<<"$f"` | |
curl $OPT -o new/$ORG_FILE | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment