blog/scripts/optimize.sh

25 lines
447 B
Bash
Raw Normal View History

2021-09-20 03:40:11 +00:00
#!/bin/sh
2023-01-16 23:42:42 +00:00
set -e
2021-09-20 03:40:11 +00:00
# Build to optimize images and not much else if im being honest
2023-01-16 23:42:42 +00:00
usage() {
cat <<EOF
Summary:
Will compress and resize images so that they don't take up too much space
and are easier on traffic usage
Usage:
optimize.sh [files to optimize...]
EOF
}
if [ -z "$1" ]; then
usage
exit 1
fi
2021-09-20 03:40:11 +00:00
mkdir -p output/
for f in "$@"; do
convert -resize 900x $f output/`basename $f`
convert -strip -quality 85 $f output/`basename $f`
done