context.Response.ContentType = "text/html";
HttpPostedFile file = context.Request.Files["Imag"];
string path = AppDomain.CurrentDomain.BaseDirectory + file.FileName;
using (Image map= Image.FromStream(file.InputStream))
{
//给画布创建一个画笔
using (Graphics g=Graphics.FromImage(map))
{
g.DrawString("水印水印水印水印", new Font("黑体", 30, FontStyle.Regular), Brushes.Red, new PointF(map.Width/2, map.Height/2));
//将画布保存成一张图片
map.Save(context.Request.MapPath(file.FileName ), System.Drawing.Imaging.ImageFormat.Jpeg);
context.Response.Write("<html><body><img src='"+ file.FileName + "'/></body></html>");
}
}