Comment dessiner le texte sur un jpg et enregistrer à nouveau en utilisant System.Drawing en C #
-
29-09-2019 - |
Question
Quelqu'un a bon exemple de la façon d'écrire un texte sur une image jpg et enregistrer à nouveau en utilisant System.Drawing dans .NET?
La solution
Oui, vous pouvez le faire assez facilement ...
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");
Autres conseils
Je suis tombé sur eux, espérons que ces aide
http://www.codeproject.com/KB/web-image/ TextOnImage.aspx
http: // www.switchonthecode.com/tutorials/csharp-snippet-tutorial-how-to-draw-text-on-an-image
graphiques Acquire de l'image appelant CreateGraphics (), utilisez la méthode de Graphics.DrawString et de l'enregistrer au besoin.
Plus d'infos: http://msdn.microsoft.com/en-us /library/system.drawing.graphics.drawstring.aspx
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow