Forked from julianxhokaxhiu/pagespeed_optimize_images.sh
Last active
July 10, 2020 18:19
-
-
Save kbihler/8e2e13c96032f740df788665596252b2 to your computer and use it in GitHub Desktop.
Recursively optimize all PNG and JPG files wherever they are from the script position and inner ( based on OPTING and JPEGOPTIM )
This file contains hidden or 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 | |
| find . -type f -name "*.png" -o -name "*.PNG" | xargs optipng -nb -nc | |
| find . -type f -name "*.jpg" -o -name "*.JPG" | xargs jpegoptim -f --strip-all | |
| find . -type f -name "*.jpeg" -o -name "*.JPEG" | xargs jpegoptim -f --strip-all | |
| find . -type f -name "*.gif" | xargs gifsicle --batch -V -O2 | |
| find . -type f -name "*.svg" -print0 | xargs -0 -n 1 -P 6 svgo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment