image-optimization.sh
· 728 B · Bash
Bruto
# from: https://gist.github.com/w33zy/7b948d10175f5417af60ce0128e1e1bd
# Install jpegoptim and optipng
apt update && apt install jpegoptim optipng -y
# JPG optimization
cd /path/to/your/image/folder
find . -iname "*.jp*" -print0 | xargs -0 jpegoptim --strip-all -m76
# PNG optimization
cd /path/to/your/image/folder
find . -iname '*.png' -print0 | xargs -0 optipng -o7 -preserve
# from: https://ayrn.io/bulk-optimize-jpg-png-images-ubuntu/
# from: https://gist.github.com/VirtuBox/e00d67ed177aa0d5af0edf2d087ef43c
# AAPanel
find /www/wwwroot/*/wp-content/uploads -name "*.jpg" -exec jpegoptim --all-progressive --strip-all '{}' \;
find /www/wwwroot/*/wp-content/uploads -iname '*.png' -print0 | xargs -0 optipng -o7 -preserve
1 | # from: https://gist.github.com/w33zy/7b948d10175f5417af60ce0128e1e1bd |
2 | # Install jpegoptim and optipng |
3 | apt update && apt install jpegoptim optipng -y |
4 | |
5 | # JPG optimization |
6 | cd /path/to/your/image/folder |
7 | find . -iname "*.jp*" -print0 | xargs -0 jpegoptim --strip-all -m76 |
8 | # PNG optimization |
9 | cd /path/to/your/image/folder |
10 | find . -iname '*.png' -print0 | xargs -0 optipng -o7 -preserve |
11 | |
12 | # from: https://ayrn.io/bulk-optimize-jpg-png-images-ubuntu/ |
13 | # from: https://gist.github.com/VirtuBox/e00d67ed177aa0d5af0edf2d087ef43c |
14 | |
15 | # AAPanel |
16 | find /www/wwwroot/*/wp-content/uploads -name "*.jpg" -exec jpegoptim --all-progressive --strip-all '{}' \; |
17 | find /www/wwwroot/*/wp-content/uploads -iname '*.png' -print0 | xargs -0 optipng -o7 -preserve |