Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save joelhooks/b951aad3459d579de9598640b86e2bb5 to your computer and use it in GitHub Desktop.

Select an option

Save joelhooks/b951aad3459d579de9598640b86e2bb5 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, PNGCRUSH, ADVANCECOMP and JPEGOPTIM )
#!/bin/bash
find . -name "*.png" | xargs optipng -nx
find . -name "*.PNG" | xargs optipng -nx
find -type f -name "*.jpg" -exec jpegoptim --strip-all {} \;
find -type f -name "*.JPG" -exec jpegoptim --strip-all {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment