Skip to content

Instantly share code, notes, and snippets.

@s4l1h
Last active November 16, 2015 12:04
Show Gist options
  • Save s4l1h/553d00b71d4ab14c17d9 to your computer and use it in GitHub Desktop.
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.
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