Add support for rotation

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2024-02-01 00:35:48 +01:00
parent 651684ef56
commit 355470d910
Signed by: luzifer
SSH key fingerprint: SHA256:/xtE5lCgiRDQr8SLxHMS92ZBlACmATUmF1crK16Ks4E

View file

@ -11,9 +11,10 @@ DPI=150
h=${A4H} h=${A4H}
w=${A4W} w=${A4W}
rotate=0
scalearg="" scalearg=""
while getopts "d:fhl" opt; do while getopts "d:fhlr:" opt; do
case "${opt}" in case "${opt}" in
d) DPI=${OPTARG} ;; d) DPI=${OPTARG} ;;
f) scalearg="^" ;; f) scalearg="^" ;;
@ -22,6 +23,7 @@ while getopts "d:fhl" opt; do
h=${A4W} h=${A4W}
w=${A4H} w=${A4H}
;; ;;
r) rotate=${OPTARG} ;;
esac esac
done done
@ -33,6 +35,7 @@ shift
exec convert "$@" \ exec convert "$@" \
-compress jpeg \ -compress jpeg \
-rotate ${rotate} \
-resize $((w * DPI))x$((h * DPI))${scalearg} \ -resize $((w * DPI))x$((h * DPI))${scalearg} \
-gravity center \ -gravity center \
-extent $((w * DPI))x$((h * DPI)) \ -extent $((w * DPI))x$((h * DPI)) \