آموزش افزودن واترمارک به تصویر با استفاده از زبان برنامه نویسی سی شارپ
سلام دوستان
در این مقاله سعی داریم به عکس خودمون واترمارک اضافه کنیم
برای انجام این کار به شکل زیر پیش می ریم
در button با نام کانورت کد زیر را وارد کنید
private void btnConvert_Click(object sender, EventArgs e)
{
    using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "JPEG|*.jpg|PNG|*.png" })
    {
        if (ofd.ShowDialog() == DialogResult.OK)
        {
            Image img = Image.FromFile(ofd.FileName);
            pictureBox1.Image = img;
            pictureBox2.Image = CreateWatermarkImage(img, "foxlearn.com", 50);
        }
    }
}یک متد به شکل زیر بسازید
public Image CreateWatermarkImage(Image img, string text, int size)
{
    Bitmap bmp = new Bitmap(img);
    //choose font for text
    Font font = new Font("Arial", size, FontStyle.Bold, GraphicsUnit.Pixel);
    //c# add transparent watermark image
    Color color = Color.LightGray;
    //location of the watermark text in the source image
    Point point = new Point(bmp.Width / 2, bmp.Height / 2);
    SolidBrush brush = new SolidBrush(color);
    //c# add text to image
    Graphics g = Graphics.FromImage(bmp);
    g.DrawString(text, font, brush, point);
    g.Dispose();
    return bmp;
} 
	 
	 
                
                