#!/usr/bin/env bash # Generate a poster for every title in catalog.py: a gradient with the title # and year, 500x750 JPEG in posters/. Needs ImageMagick 7 and fontconfig. set -euo pipefail cd "$(dirname "$0")" font=$(fc-match -f '%{file}' 'DejaVu Serif:style=Bold') small=$(fc-match -f '%{file}' 'DejaVu Sans') mkdir -p posters python3 -c ' import catalog for m in catalog.MOVIES: print("m%d|%s|%d|%s|%s" % (m[0], m[1], m[2], m[10][0], m[10][1])) for s in catalog.SERIES: print("s%d|%s|%d|%s|%s" % (s[0], s[1], s[2], s[7][0], s[7][1])) ' | while IFS='|' read -r id title year c1 c2; do magick -size 500x750 "gradient:$c1-$c2" \ \( -size 420x320 -background none -fill white -font "$font" -gravity center caption:"$title" \) \ -gravity north -geometry +0+120 -composite \ \( -size 420x60 -background none -fill '#ffffffcc' -font "$small" -pointsize 30 -gravity center caption:"$year" \) \ -gravity south -geometry +0+70 -composite \ -quality 88 "posters/$id.jpg" done