Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
600 B

  1. #!/bin/bash
  2. # Simple script for optimizing all images for a website
  3. #
  4. # @author Jeffery Russell 7-19-18
  5. WIDTH="690>" # the ">" tag specifies that images will not get scaled up
  6. folders=("./entries" "./img")
  7. for folder in "${folders[@]}"; do
  8. for f in $(find $folder -name '*.jpg' -or -name '*.JPG'); do
  9. convert "$f" -resize $WIDTH "$f"
  10. jpegoptim --max=80 --strip-all --preserve --totals --all-progressive "$f"
  11. done
  12. for f in $(find $folder -name '*.png' -or -name '*.PNG'); do
  13. convert "$f" -resize $WIDTH "$f"
  14. optipng -o7 -preserve "$f"
  15. done
  16. done