loom/scripts/generate-thumbs.sh

21 lines
457 B
Bash
Raw Normal View History

2022-02-26 19:56:46 +00:00
#!/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"