Skip to content

Instantly share code, notes, and snippets.

@kphrx
Last active June 5, 2018 10:13
Show Gist options
  • Save kphrx/af92b101f058b8d311dbffb8bcb12e3b to your computer and use it in GitHub Desktop.
Save kphrx/af92b101f058b8d311dbffb8bcb12e3b to your computer and use it in GitHub Desktop.
#!/bin/bash
DIR=`pwd`
JPEG="-name '*.jpg' -o -name '*.jpeg'"
PNG="-name '*.png' -o -name '*.gif'"
OPTIJPG="jpegoptim --strip-all --max=80"
OPTIPNG="optipng -strip all -o7"
find ${DIR} -print0 ${JPEG} | xargs -0 ${OPTIJPG}
find ${DIR} -print0 ${PNG} | xargs -0 ${OPTIPNG}
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment