安装JPG和PNG压缩
yum install jpegoptim yum install optipng
然后在需要压缩的目录下执行如下命令进行压缩jpg格式的图片
//压缩JPG find . -name '*.jpg' | xargs jpegoptim --strip-all //压缩PNG find -type f -name "*.png" -exec optipng {} ;
参考
- https://www.tecmint.com/optimize-and-compress-jpeg-or-png-batch-images-linux-commandline/
- https://www.webmaster.net/tutorials/install-jpegoptim-in-ubuntu-or-centos-compress-your-images-losslessly-to-optimize-google-pagespeed-score.html