I wanted to insert legends directly in images instead of displaying them below respective images. ImageMagick can do that (Text directive) but it’s not smart enough to make the legend always visible, even in dark images (if the legend color is black). So i used this script to accomplish that task. Legend is inserted at the bottom of the image, in a little black bordered box. Advice: use pilfonts because default font is a bit small :-)
Here is a sample output: