This project has moved and is read-only. For the latest updates, please go here.

Merging Text On An Input Image To Produce a Final Image With Text

Nov 26, 2015 at 12:41 PM

I have a base image and some text. I need to apply some font type, font size and color styles on the text, merge it with the base image at a predefined location and then produce a final image with formatted text as part of the image.

I tried using image.Annotate() method and it works fine to add plain text at a particular Gravity. But it doesn't allow me to format the text with a specific font type, color and size. I need to be able to do that.

Please help
Nov 26, 2015 at 4:32 PM
Can you post the code of what you tried so far?
Nov 27, 2015 at 4:42 AM

Nothing major. Simple 3 lines below reads an image from file system, adds the text onto it and then flushes out the revised image. Works fine just that I am not able to format the text "Test Insertion of Text" with different font type, size and color.

using (MagickImage image = new MagickImage(imagePath + sourceFileName))
                MagickImage blueChnImg = image.Clone();
                blueChnImg.Annotate("Test Insertion of Text", Gravity.West);

                blueChnImg.Write(imagePath + "move-bg-01_withText.jpg");
Nov 29, 2015 at 10:48 AM
The MagickImage class has various properties for this: Font/FontPointsize/StrokeColor/FillColor.
Nov 30, 2015 at 5:50 AM

I do not want to change the font style and formatting of my image. I only want to apply formatting of the annotated text which is supplied as a string to the Annotate() method. I believe the properties in MagickImage class that you mentioned would be used to change image itself right? How do I apply formatting on the text that I am annotating?
Nov 30, 2015 at 6:48 AM
Sorry I just tried using these properties before I execute the Annotate() method and it worked. Previously I was Annotating() earlier and then setting these properties and hence it was not working. I will get back if I am not able to achieve the desired formatting
Nov 30, 2015 at 7:31 AM
Edited Nov 30, 2015 at 7:33 AM
Update. Even though I am able to format the text to an extent but still not able to achieve the desired output. I need to be able to add text on the image with formatting like in sample image at Sample Image

Please help and let me know if this kind of formatting is achievable
Nov 30, 2015 at 4:01 PM
What you could do is create an image with the text and 'compose' it on top of your other image.
Nov 30, 2015 at 5:49 PM
Thanks for the reply. I tried this already using the watermark approach described at [Watermark approach(

Problem remains the same on how do I create the image with exact formatting as I require in the sample image I shared earlier. The properties within MagickImage class do not give me a way to achieve exactly that.