Be smart about thumbnailing and uploading benches

This commit is contained in:
2018-11-13 08:46:44 -08:00
parent 9babb7f435
commit 1e5f2a631b
4 changed files with 23 additions and 11 deletions

View File

@@ -4,14 +4,17 @@ set -e
set +x
for FILE in img/bench/webp-src/*.jpg; do
OUT="${FILE%.*}.webp"
OUT2X="${FILE%.*}@2x.webp"
if [ ! -f ../$OUT ]; then
cwebp -mt -resize 160 0 -q 40 $FILE -o $OUT
FULLNAME=$(basename -- ${FILE})
NAME=${FULLNAME%.*}
OUT="img/bench/${NAME}.webp"
OUT2X="img/bench/${NAME}@2x.webp"
echo "Checking for \"${OUT}\"..."
if [ ! -f "${OUT}" ]; then
echo "Would thumbnail ${OUT}"
cwebp -mt -resize 160 0 -q 40 ${FILE} -o ${OUT}
fi
if [ ! -f ../$OUT2X ]; then
cwebp -mt -q 40 $FILE -o $OUT2X
if [ ! -f "${OUT2X}" ]; then
echo "Would thumbnail@2x ${OUT2X}"
cwebp -mt -q 40 ${FILE} -o ${OUT2X}
fi
done
mv img/bench/webp-src/*.webp img/bench/