Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

image_optimize.sh 484 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
  1. #!/usr/bin/env bash
  2. #
  3. # Optimize images to reduce the file sizes
  4. #
  5. # Usage: bash image_optimize.sh *.png
  6. #
  7. # Note: Requires pngquant to be installed
  8. #
  9. if [ "$#" == 0 ]; then
  10. echo "Usage: bash image_optimize.sh *.png"
  11. exit 1
  12. fi
  13. if ! [ -x "$(command -v pngquant)" ]; then
  14. echo 'Error: pngquant is not found in your search PATH.' >&2
  15. exit 1
  16. fi
  17. for image in "$@"; do
  18. echo "Optimizing ${image}"
  19. pngquant --skip-if-larger --strip --force --ext .png ${image}
  20. done
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...