문제

Anyone have good example of how to write text onto a jpg image and resave it using System.Drawing in .NET?

도움이 되었습니까?

해결책

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");

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top