Skip to content

Instantly share code, notes, and snippets.

@acechase
Last active August 29, 2015 13:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acechase/8870414 to your computer and use it in GitHub Desktop.
Save acechase/8870414 to your computer and use it in GitHub Desktop.
optimize all the jpg's for your (rails or other) application
# This assumes you're using OS X, but should work on any linux-based system
# These two find commands could be run as part of the asset packaging step...
brew install jpegoptim
# checkout disk usage before hand
du -h -d 1 .
# add -n to jpegoptim options to do a dry run
find . -name "*.jpg" -exec jpegoptim --strip-all {} \;
brew install optipng
# use optipng takes a -simulate option for a dry run
find . -name "*.png" -exec optipng {} \;
# check optimized disk usage
du -h -d 1 .
# profit!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment