Anyone have good example of how to write text onto a jpg image and resave it using System.Drawing in .NET?
Asked
Active
Viewed 2,496 times
3 Answers
5
Yes you can do it fairly easily...
Bitmap bmp = new Bitmap("C:\\test.jpg");
Graphics gra = Graphics.FromImage(bmp);
string text = "Hello\nWorld";
gra.DrawString(text, new Font("Verdana", 24), Brushes.Black, new PointF(0, 0));
bmp.Save("C:\\test_out.jpg");

Josh Stodola
- 81,538
- 47
- 180
- 227
1
I came across these, hope these help
http://www.codeproject.com/KB/web-image/TextOnImage.aspx
http://www.switchonthecode.com/tutorials/csharp-snippet-tutorial-how-to-draw-text-on-an-image

Mahesh Velaga
- 21,633
- 5
- 37
- 59
1
Acquire graphics from image calling CreateGraphics(), use its Graphics.DrawString method and save it as required.
More info: http://msdn.microsoft.com/en-us/library/system.drawing.graphics.drawstring.aspx

Grozz
- 8,317
- 4
- 38
- 53