Click here to Skip to main content
15,886,823 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am trying to make a custom C# Windows Form app "Image Editior" which will simply load my images in a picture box using a dialogue file box & I wanna write on my Images simply a text. How will I do it??

What I have tried:

I have not find any resources nor any direction till yet because I am very new on this language.
Posted
Updated 15-Mar-22 19:18pm

You don't need Emgu-CV to accomplish this, just standard .NET code, see:
Dynamically Write Text On An Image[^]
 
Share this answer
 
Try below code using graphics.DrawString:

string myText= "Hello World";


PointF firstLocation = new PointF(10f, 10f);
PointF secondLocation = new PointF(10f, 50f);

string filePath = @"path\image.bmp"
Bitmap bitmap = (Bitmap)Image.FromFile(filePath );//load the bmp image file

using(Graphics graphics = Graphics.FromImage(bitmap))
{
using (Font font= new Font("Arial", 9))
{
graphics.DrawString(myText, font, Brushes.Blue, firstLocation);
}
}

bitmap.Save(filePath );//save the image file
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900