server/core/img/image-optimization.sh

21 lines
422 B
Bash
Raw Normal View History

2013-04-13 08:01:13 +00:00
#!/bin/bash
function recursive_optimize_images() {
cd $1;
optipng -o6 *.png;
jpegoptim --strip-all *.jpg;
for svg in `ls *.svg`;
do
mv $svg $svg.opttmp;
scour -i $svg.opttmp -o $svg --create-groups --enable-id-stripping --enable-comment-stripping --shorten-ids --remove-metadata;
done;
rm *.opttmp
for dir in `ls -d */`;
do
recursive_optimize_images $dir;
cd ..;
done;
}
recursive_optimize_images ../../