Skip to content

Instantly share code, notes, and snippets.

@girvan
Created February 4, 2015 01:50
Show Gist options
  • Save girvan/51daa6dea84f41e29042 to your computer and use it in GitHub Desktop.
Save girvan/51daa6dea84f41e29042 to your computer and use it in GitHub Desktop.
tinypng api
tinypng() {
for f in *.png
do
cmd="curl -s --user api:YOUR_API_KEY --data-binary @$f https://api.tinypng.com/shrink | sed 's/.*https/https/g' | sed 's/\.png.*/.png/g' | xargs curl -s -o $f"
eval "$cmd";
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment