Created
April 26, 2026 06:15
-
-
Save dannyvankooten/843805fe19ec50827fd1bcdbd22f12d7 to your computer and use it in GitHub Desktop.
Run all images in wp-content/uploads through lossless compression.
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
| # PNG files: optipng | |
| find wp-content/uploads -name '*.png' -exec optipng {} + | |
| # JPG files: jpegtran | |
| find wp-content/uploads -name '*.jpg' -o -name '*.jpeg' | xargs -I{} jpegtran -copy none -optimize -outfile {} {} | |
| # Webp: cwebp | |
| find wp-content/uploads -name '*.webp' -exec cwebp -lossless {} -o {} \; | |
| # GIF: gifiscle | |
| find wp-content/uploads -name '*.gif' -exec gifsicle -O3 -b {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment