-
-
Save Mallinanga/5280748 to your computer and use it in GitHub Desktop.
#shell Minify images
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/bash | |
base_path=__PATH__ | |
if type -P jpegtran &>/dev/null; then | |
echo 'Running jpegtran'; | |
find $base_path -iname "*.jpg" -type f -exec jpegtran -outfile '{}' -copy none -optimize -progressive '{}' \; | |
else | |
echo 'jpegtran not found'; | |
fi | |
if type -P pngcrush &>/dev/null; then | |
echo 'Running pngcrush'; | |
find $base_path -iname "*.png" -type f -exec pngcrush -reduce -brute -nofilecheck '{}' '{}-crushed' \; | |
else | |
echo 'pngcrush not found'; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment