Add watermark in your photo using C#

Some of my photos need to be added watermark to prevent abusing. I just found a easy way to add watermark into your photo using C#. Here is the code to share.

private void button1_Click(object sender, System.EventArgs e)
	OpenFileDialog of = new OpenFileDialog();
	of.Filter = "Image Files (*.bmp;*.emf;*.exif;*.gif;*.jpg;*.png;*.tif;*.wmf)|*.bmp;*.emf;*.exif;*.gif;*.jpg;*.png;*.tif;*.wmf";

	if(of.ShowDialog(this) == DialogResult.OK)
		Image image = Image.FromFile(of.FileName);
		Graphics g = Graphics.FromImage(image);

		// Create a solid brush to write the watermark text on the image
		Brush myBrush = new SolidBrush(Color.Black);
		Font myFont = this.Font;
		// Calculate the size of the text
		SizeF sz = g.MeasureString("", myFont);

		// drawing position (X,Y)
		float X =(image.Width - sz.Width)/2f;
		float Y = image.Height/2f;

		SaveFileDialog sf = new SaveFileDialog();
		sf.Filter = of.Filter;
		if(sf.ShowDialog(this) == DialogResult.OK)

This is the sample

watermark sample
watermark sample