Files
scottyah-blog/scripts/make_webp.sh
2025-12-24 13:48:24 -08:00

14 lines
407 B
Bash
Executable File

#!/bin/bash
SCRIPT_DIR=$(dirname "$(readlink -f "$0")")
# Find all files of type PNG, JPEG, or TIFF
files=$(find $SCRIPT_DIR/../hugo-content/static/img/ -type f -iname "*.png" -o -iname "*.jpg" -o -iname "*.tif")
# Loop through all the files in the directory
for file in $files; do
# Convert the file to WEBP
cwebp -resize 1500 0 $file -o "${file%.*}.webp"
# Delete old file
rm $file
done