Skip to content

Instantly share code, notes, and snippets.

@Iman
Created April 29, 2018 19:11
Show Gist options
  • Save Iman/901000acda7dc41ab238313a4c69a557 to your computer and use it in GitHub Desktop.
Save Iman/901000acda7dc41ab238313a4c69a557 to your computer and use it in GitHub Desktop.
Optimize JPEG and PNG
#!/usr/bin/env bash
#find /var/www/ -name "*.png" -print0 | xargs -0 sudo chmod +w *.png
find /var/www/ -name "*.png" -print0 | xargs -0 sudo optipng -o7
#find /var/www/ -name "*.jpg" -print0 | xargs -0 sudo chmod +w *.jpg
find /var/www/ -name "*.jpg" -print0 | xargs -0 sudo jpegoptim -m 90 -t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment