Created
June 18, 2022 13:54
-
-
Save DanielOberlechner/abff9d1b1f18b7a806e8b0ed3674816b to your computer and use it in GitHub Desktop.
webp convert all files in current folder with best compression
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# -m maximize compression power | |
# -mt multithreading | |
# -q quality | |
# -af optimize with auto filter | |
# -size enter the wanted compression file size in bytes 250000 are 250 kiloBytes | |
PARAMS=('-m 6 -q 50 -mt -af -progress') | |
if [ $# -ne 0 ]; then | |
PARAMS=$@; | |
fi | |
cd $(pwd) | |
shopt -s nullglob nocaseglob extglob | |
for FILE in *.@(jpg|jpeg|tif|tiff|png|svg); do | |
cwebp $PARAMS "$FILE" -o "${FILE%.*}".webp; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment