dotfiles/.local/bin/scripts/shrinkimg

12 lines
365 B
Bash
Executable File

#!/bin/sh
while true
do case $1 in
(-o) out="$2"; shift 2;;
(-q) quality="$2"; shift 2;;
(*) break;;
esac
done
test $# -eq 0 && echo "Usage: $0 [-q quality (default 85)] [-o outfile] <images...>" && exit 1
magick "$@" -strip -interlace Plane -define jpeg:dct-method=float -sampling-factor 4:2:0 -gaussian-blur 0.05 -quality "${quality:-85}" "$out"