Skip to content

Instantly share code, notes, and snippets.

@batosai
Created December 4, 2021 23:53
Show Gist options
  • Save batosai/b787860aad64022ace2b40189e3817f2 to your computer and use it in GitHub Desktop.
Save batosai/b787860aad64022ace2b40189e3817f2 to your computer and use it in GitHub Desktop.
bash script for optim image jpg and png. pngquant and jpegoptim are required
echo "\n \033[32m ###################### PNG ###################### \033[0m \n"
find './assets/build' -iname '*.png' -exec pngquant --verbose --ext .png --force 256 --strip {} \;
# find './build' -iname "*.png" -exec optipng -o5 -strip all {} \;
echo "\n \033[32m ###################### JPG ###################### \033[0m \n"
find './assets/build' -iname "*.jpeg" -exec jpegoptim -m80 --all-progressive --strip-all {} \;
find './assets/build' -iname "*.jpg" -exec jpegoptim -m80 --all-progressive --strip-all {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment