I am creating a
title with the following in a script:
(I've left the vars for font and fontsize to show they can change, and
obviously the text "This is a test" is dynamic as well.)
convert -size 620x300 xc:none \
-font "$TITLES_FONT" -pointsize $TITLES_FONTSIZE \
-fill '#101010' -stroke '#101010' -gravity South \
-annotate +0+0 "$TITLE" \
-fill $TITLES_COLOUR -strokewidth 1 -stroke "$TITLES_STROKE" \
-annotate +1+1 "This is a test" title.png
Then, for a spumux button layer I need a button.png (max 4 colours including
colours formed from overlapping colours) with same text, that will fit
exactly so the fill of the button.png matches the 2nd annotation (+1+1), but
all other parts are fully transparent.
convert +antialias -depth 2 -background none \
-fill none -size 620x300 xc:none \
-font "$TITLES_FONT" -pointsize $TITLES_FONTSIZE \
-fill none -stroke none -gravity South \
-annotate +0+0 "$TITLE" \
-fill '#266CAE' -stroke none \
-annotate +1+1 "$TITLE" \
button.png
Somehow I need to get these two images the same size, so that as mentioned,
when overlayed by the DVD player, the '#266CAE' fill of the button.png fills
the $TITLES_COLOUR fill of the title.png.
What I've tried:
trim 3 sides of the title.png using -gravity south, using
-gravity South -background white -splice 0x1 -background black -splice 0x1 \
-trim +repage -chop 0x1 ... etc.
then cut out the button.png
using the shape of the title.png, using -gravity South and -compose Src.
This doesn't quite get them lined up, do to the extra height and width of the
stroke.