1.)Load Image object 2.)Create a graphics object from that image 3.)Create a Font object, Brush object and a PointF object representing the location on image where you want to write string. 4.)Save the image.
Image image = Image.FromFile("ImageNameAndPath");
using (Graphics g = Graphics.FromImage(image)) { Brush solidBrush = new SolidBrush(Color.Red); FontFamily family= new FontFamily("Verdana"); Font font = new Font(family,(float)10.00); PointF location = new PointF(10, 10); g.DrawString("This is a test", font, solidBrush, location); image.Save(ImageNameAndPath); }
|
| Author: Kapil Dhawan 18 Jun 2008 | Member Level: Gold Points : 2 |
Hello Nice piece of code Thanks for sharing your knowledge with us. I hope to see more good code from your side This code will help lots of guys Thanks to you Regards, Kapil
|