I am using C# and Magick.Net to annotate images, as follows:
var text = "Variable text";
var img = new MagickImage("image.jpg");
img.FontPointsize = 50;
img.FillColor = new MagickColor(Color.White);
img.Annotate(text, Gravity.Northwest);
Annotation works, however text is not always easily readable, as it can blend with the image.
The ImageMagick manual has a full section suggesting solutions for this:
Outlined Label
convert dragon.gif -gravity south \ -stroke '#000C' -strokewidth 2 -annotate 0 'Faerie Dragon' \ -stroke none -fill white -annotate 0 'Faerie Dragon' \ anno_outline.jpg
Draw Dim Box
convert dragon.gif \ -fill '#0008' -draw 'rectangle 5,128,114,145' \ -fill white -annotate +10+141 'Faerie Dragon' \ anno_dim_draw.jpg
(I'd use this method only if nothing else works, because it requires the rectangle width and height to be explicitly defined.)
Undercolor Box
convert dragon.gif -fill white -undercolor '#00000080' -gravity South \ -annotate +0+5 ' Faerie Dragon ' anno_undercolor.jpg
Composited Label
convert -background '#00000080' -fill white label:'Faerie Dragon' miff:- |\ composite -gravity south -geometry +0+3 \ - dragon.gif anno_composite.jpg
Auto-Sized Caption
width=`identify -format %w dragon.gif`; \ convert -background '#0008' -fill white -gravity center -size ${width}x30 \ caption:"Faerie Dragons love hot apple pies\!" \ dragon.gif +swap -gravity south -composite anno_caption.jpg
Fancy Label
convert -size 100x14 xc:none -gravity center \ -stroke black -strokewidth 2 -annotate 0 'Faerie Dragon' \ -background none -shadow 100x3+0+0 +repage \ -stroke none -fill white -annotate 0 'Faerie Dragon' \ dragon.gif +swap -gravity south -geometry +0-3 \ -composite anno_fancy.jpg
Any of the above approaches would be fine with me. However, I can't seem to find the required functionality exposed in the .Net API. For example, I tried setting BackgroundColor, before calling Annotate. This did not produce any effect:
img.BackgroundColor = new MagickColor(Color.Black);
I would like some pointers about how to implement any method that enhances readability of the annotation text, using Magick.Net.