Last active
April 16, 2025 15:25
-
Star
(119)
You must be signed in to star a gist -
Fork
(23)
You must be signed in to fork a gist
-
-
Save tabrindle/ed9f77b4e96f4c98b49b to your computer and use it in GitHub Desktop.
Convert all files in directory to webp, with default params, or standard cwebp params passed from command
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 | |
PARAMS=('-m 6 -q 70 -mt -af -progress') | |
if [ $# -ne 0 ]; then | |
PARAMS=$@; | |
fi | |
cd $(pwd) | |
shopt -s nullglob nocaseglob extglob | |
for FILE in *.@(jpg|jpeg|tif|tiff|png); 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
Amazing! Thank you so much!🤝