-
-
Save BradMcGonigle/31e2a570dc6a79106234a8232c2f93b8 to your computer and use it in GitHub Desktop.
Crush the pngs
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
#!/bin/sh | |
# Cause stefano said: You can get them even smaller with | |
# http://www.advancemame.it/comp-readme.html after crushing | |
# it operates on the deflate compression, not the PNG image data | |
git ls-files | grep \.png$ | while read img | |
do | |
echo -n "$img..." | |
size_old=$(stat -f%z "$img") | |
advpng -q --shrink-insane --recompress "$img" | |
size_new=$(stat -f%z "$img") | |
echo $(expr $size_old - $size_new) | |
if [ $size_old -le $size_new ] | |
then | |
git checkout head "$img" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment