安装JPG和PNG压缩

 

1

2

yum install jpegoptim

yum install optipng

然后在需要压缩的目录下执行如下命令进行压缩jpg格式的图片

 

1

2

3

4

5

//压缩JPG

find . -name '*.jpg' | xargs jpegoptim --strip-all

 

//压缩PNG

find -type f -name "*.png" -exec optipng {} \;