loom/scripts/generate-thumbs.sh
2022-02-26 11:56:46 -08:00

21 lines
457 B
Bash
Executable File

#!/bin/bash
count=0
LC_ALL=C
dir=public/images/screenshots
rm -rf "${dir}"
mkdir -p "${dir}"
SECONDS=0
for file in screenshots/*.jpg; do
newName="loom-$(printf '%03d' "${count}").jpeg"
thumbName="${newName%.*}-thumb.jpeg"
echo -n "${count}: ${file}... ";
cp "${file}" "${dir}/${newName}"
magick "${file}" -resize x120 -quality 50 -strip "${dir}/${thumbName}";
echo "done";
count=$((count + 1))
done
echo "done in ${SECONDS}s"