summaryrefslogtreecommitdiff
path: root/admin/prep-quartet-photos.sh
blob: fa5264f16c26f959a811c978eaf42a394b6b703b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

set -euxo pipefail

declare -A heights=(
    [sophie]=1100
    [hervé]=1125
    [enguerrand]=1175
    [david]=1200
)

processimg ()
{
    local src=$1
    local name=$(basename "${src}")
    name="${name%% *}"
    name=${name,}
    local dst=../images/${name}/full.png
    local height=${heights[${name}]}

    magick "${src}" -trim ${dst}
    magick ${dst} -scale x${height} ${dst}
    magick ${dst} -background none -gravity north -splice 0x$((1200-height)) ${dst}
}

for img in "$@"
do
    processimg "${img}" &
done

wait