Last active
August 29, 2015 14:10
-
-
Save peterfarrell/bbce4d8f2c2f444980f5 to your computer and use it in GitHub Desktop.
Crush / compress - jpg and png bash file
This file contains 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
crush() { | |
for f in *; | |
do | |
mv "$f" `echo $f | tr ' ' '_'` | |
done | |
for f in *.png | |
do | |
echo "$f" | |
pngcrush -brute "$f"{,.} && du -b "$f"{,.} | |
cp -f "$f." "$f" | |
done | |
for f in *.jpg | |
do | |
echo "$f" | |
jpegtran "$f" > "$f." && du -b "$f"{,.} | |
cp -f "$f." "$f" | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You need to install
pngcrush
andlibjpeg-comps
(for jpegtran) on your system.