Created
December 12, 2018 13:04
-
-
Save sebstr1/61d58eb7914cec40ddbd7dc547945064 to your computer and use it in GitHub Desktop.
This file contains 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 | |
# Batch Convert all images in folder to webp. | |
# Create .sh file, paste this into the file, make it executable and run it; "./webp_batch.sh /path/to/folder/" | |
PATH=/usr/local/bin:/usr/bin:/bin | |
PARAMS=('cwebp -q 75 -alpha_q 10') # -alpha_q 10 is for images with transparent background | |
cd $1 || exit 1 | |
shopt -s nullglob nocaseglob extglob | |
for FILE in *.@(jpg|jpeg|tif|tiff|png); do | |
cwebp $PARAMS "$FILE" -o "${FILE%.*}".webp; | |
done | |
echo "Conversion complete for folder " $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment