// Add an image watermark
System. Drawing. Image image = system. Drawing. image. fromfile (path + picname );
System. Drawing. Image watermakeimage = system. Drawing. image. fromfile (copypicpath );
Graphics G = graphics. fromimage (image );
Int x = 0; // X coordinate
Int y = 0; // y coordinate
Switch (position)
{
Case "0": // top left
X = 0;
Y = 0;
Break;
Case "1": // upper right
X = image. Width-watermakeimage. width;
Y = 0;
Break;
Case "2": // bottom left
X = 0;
Y = image. Height-watermakeimage. height;
Break;
Case "3": // bottom right
X = image. Width-watermakeimage. width;
Y = image. Height-watermakeimage. height;
Break;
Default:
Break;
}
G. drawimage (watermakeimage, new rectangle (X, Y, watermakeimage. Width, watermakeimage. Height), 0, 0, watermakeimage. Width, watermakeimage. Height, graphicsunit. pixel );
G. Dispose ();
// Save the watermark image and delete the original image.
string newpath = path + "New _" + picname;
image. save (newpath);
picnamewatermack = "New _" + picname;
image. dispose ();
If (file. exists (path + picname)
{< br> file. delete (path + picname);
}