Created
February 4, 2021 11:05
-
-
Save System-Glitch/1386c48f4361e3d2945d57b4bc98d191 to your computer and use it in GitHub Desktop.
Converts many PNG images to WEBP using cwebp
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 | |
# 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