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
#!/usr/bin/env bash | |
# Collect .webp files recursively | |
FILES=() | |
while IFS= read -r -d '' FILE; do | |
FILES+=("$FILE") | |
done < <(find . -type f -iname "*.webp" -print0) | |
TOTAL=${#FILES[@]} | |
COUNT=0 |
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
#!/usr/bin/env bash | |
# Default cwebp params. Override by passing your own flags to the script. | |
PARAMS=( -m 6 -q 80 -resize 2000 0 -mt -af -progress ) | |
if [ "$#" -ne 0 ]; then | |
PARAMS=( "$@" ) | |
fi | |
# Find images under the current folder, case-insensitive, safely handle spaces and odd chars. | |
# For each file, write output next to the source with the same base name and .webp extension. |