summaryrefslogtreecommitdiff
path: root/dot/local/bin/marginate
blob: e62410c65fc8ab0f38adad41d754ce8d5c22a15a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

margin=100
aspect_ratio=177

extent=$((margin * aspect_ratio / 100))%x${margin}%
options="-gravity center -extent $extent"

for input
do
  case "$input" in
       *.*) output=${input%.*}.margins.${input##*.} ;;
       *)   output=$input.margins.png ;;
  esac
  convert "$input" $options "$output"
done