I'm trying to composite a legend on top of a graph using ImageMagick:
magick composite -gravity southeast '.\legend.png' -bordercolor black -border 1x1 '.\graph.png' '.\final.png'
As you can see the border doesn't have any padding or margin so it's not quite nice looking. However searching in the ImageMagick – Command-line Options page I see no option for those. Is there a way to do that?
This is my desired output. Notice the padding inside the box and the margin outside the box:
In Imagemagick, set -gravity southeast for the bottom left alignment and also -geometry +X+Y for the X and Y offset from the bottom left to move it up and or to the left.
convert backgroundimage legendimage -geometry +10+10 -gravity southeast -compose over -composite resultimage
If you need to add a (10 px) border inside the borderline (assume 1 px thick) of your overlay (legend), then in Unix syntax:
convert backgroundimage \
\( legendimage -shave 1x1 \
-bordercolor white -border 10x10 \
-bordercolor black -border 1x1 \) \
-geometry +10+10 -gravity southeast \
-compose over -composite resultimage