Created
November 27, 2017 08:19
-
-
Save zhangxigithub/bf93ececd7ff5daf3fe52130123e489d to your computer and use it in GitHub Desktop.
TinyPNG
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
API_KEY=123456 | |
for f in "$@" | |
do | |
JSON=$(curl --user api:$API_KEY --data-binary "@$f" -i https://api.tinify.com/shrink) | |
RESULT=${JSON##*url\":\"} | |
RESULT=${RESULT%%\"\}\}} | |
IMAGE=${f%.*}_tinypng.${f##*.} | |
curl "$RESULT" -o "$IMAGE" | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment