Skip to content

Instantly share code, notes, and snippets.

@System-Glitch
Created February 4, 2021 11:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save System-Glitch/1386c48f4361e3d2945d57b4bc98d191 to your computer and use it in GitHub Desktop.
Save System-Glitch/1386c48f4361e3d2945d57b4bc98d191 to your computer and use it in GitHub Desktop.
Converts many PNG images to WEBP using cwebp
#!/bin/bash
# Converts PNG images to WEBP
# If no argument is given, all PNG images in the
# working directory are converted.
# Otherwise only the files given as arguments will be
# converted.
files="$@"
if [ $# -eq 0 ]; then
files=`find . -name "*.png"`
fi
for file in $files; do
cwebp -q 80 "$file" -o "${file%.*}.webp"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment