#!/bin/bash
# usage: ./create_card.sh <background_image> "<song_name>" "<artist>" "<year>" "<duration>"
# create base image with background
magick "$1" -gravity center -extent 1186x640 base.png
# add dark overlay
magick base.png \( +clone -fill black -colorize 89% \) -composite overlay.png
# add text with shadows
magick overlay.png \
\( -size 1186x640 xc:transparent \
-fill black -font "Inter-Bold" \
-pointsize 109 \
-annotate +47+490 "$2" \
-pointsize 72 \
-annotate +47+593 "$3 - $4" \
-pointsize 44 \
-annotate +1017+598 "$5" \
-channel A -gaussian-blur 5x5 \
-channel A -evaluate multiply 0.5 +channel \
\) -composite \
\( -size 1186x640 xc:transparent \
-fill white -font "Inter-Bold" \
-pointsize 109 \
-annotate +45+488 "$2" \
-pointsize 72 \
-annotate +45+591 "$3 - $4" \
-pointsize 44 \
-annotate +1015+596 "$5" \
\) -composite \
output_title_card.png
# clean up temporary files
rm base.png overlay.png