Last active
September 23, 2016 17:58
-
-
Save jvrsgsty/aaada4f0a69bb9e0a649b087ec88c05f to your computer and use it in GitHub Desktop.
Optimize PNGs and JPGs in a directory using pngcrush and jpegtran
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
#!/bin/bash | |
for f in *.png; do pngcrush -rem alla -reduce -brute $f $f.new; done; | |
for f in *.jpg; do jpegtran -copy none -optimize $f > $f.new; done; | |
rm *.png | |
rm *.jpg | |
for f in *.new; do mv $f ${f%.*}; done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment