Last active
September 26, 2017 07:29
-
-
Save mklooss/6275befeaf6024d83cec to your computer and use it in GitHub Desktop.
optipng / jpegoptim
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 | |
# combine mozjpeg and jpegoptim | |
# you have to build https://github.com/mozilla/mozjpeg first | |
# path = /opt/mozjpeg | |
# ~# find . -iname "*.jp*g" -type f -exec jpegcompress "{}" \; | |
if [ -z "$1" ]; then | |
echo "is empty" | |
exit; | |
fi | |
export PATH=/opt/mozjpeg/bin/:$PATH | |
export LD_LIBRARY_PATH=/opt/mozjpeg/lib:$LD_LIBRARY_PATH | |
jpegtran -copy none -optimize -progressive -outfile "$@" "$@" | |
jpegoptim -o --strip-all --max=90 --all-progressive "$@" |
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 | |
#JPEG | |
find . -iname "*.jp*g" -type f -exec jpegoptim -o --strip-all --max=90 --all-progressive "{}" \; | |
#PNG | |
find . -iname "*.png" -type f -exec optipng -o9 -strip all "{}" \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For PNGs add "-strip all":
find . -iname "*.png" -type f -exec optipng -o9 -strip all "{}" \;