Files
scottyah-blog/scripts/make_webp.sh
2023-08-23 21:38:40 -07:00

12 lines
350 B
Bash
Executable File

#!/bin/bash
# Find all files of type PNG, JPEG, or TIFF
files=$(find ../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