Skip to content

Instantly share code, notes, and snippets.

@zbeekman
Last active February 3, 2017 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zbeekman/7482ccd0e87f495387951bd612dc390e to your computer and use it in GitHub Desktop.
Save zbeekman/7482ccd0e87f495387951bd612dc390e to your computer and use it in GitHub Desktop.
Use `git filter-branch` to crush all `.png` files in `<path/to/img/dir/here>` on OS X with imageoptim, imageoptim-cli, and ImageAlpha.app
git filter-branch --prune-empty --tree-filter 'pwd ; ls -a ; imageoptim -a -q --verbose -d <path/to/img/dir/here> || true' -- --all
@zbeekman
Copy link
Author

zbeekman commented Feb 3, 2017

You can also crush jpegs with jpegmini, however I actually didn't have any jpgs to crush and accidentally threw the --jpeg-mini flag, and a lot of errors were produced.... presumably imageoptim-cli will correct paths to jpgs correctly if they are present, but YMMV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment