Skip to content

Instantly share code, notes, and snippets.

@chrisvogt
Created July 8, 2024 05:37
Show Gist options
  • Save chrisvogt/445a50c21b07e9fd46280ac1028050c9 to your computer and use it in GitHub Desktop.
Save chrisvogt/445a50c21b07e9fd46280ac1028050c9 to your computer and use it in GitHub Desktop.
Converts all .jpg images in the current directory to .webp format with the quality set to 90 and output them to a webp-90 subdirectory:
mkdir -p webp-90
for filepath in *.jpg; do
filename=$(basename "$filepath" .jpg)
cwebp -q 90 "$filepath" -o "webp-90/$filename.webp"
echo "Converted $filepath to webp-90/$filename.webp"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment