asp.net(c#)如何实现图片上传并加水印
- 提问者网友:轻浮
- 2021-05-09 09:48
- 五星知识达人网友:低血压的长颈鹿
- 2021-05-09 11:26
- 1楼网友:蓝房子
- 2021-05-09 11:45
/// <summary> /// 在图片上生成图片水印 /// </summary> /// <param name="Path">原服务器图片路径</param> /// <param name="Path_syp">生成的带图片水印的图片路径</param> /// <param name="Path_sypf">水印图片路径</param> protected void AddWaterPic(string Path, string Path_syp, string Path_sypf) { System.Drawing.Image image = System.Drawing.Image.FromFile(Path); System.Drawing.Image copyImage = System.Drawing.Image.FromFile(Path_sypf); System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image); g.DrawImage(copyImage, new System.Drawing.Rectangle(image.Width - copyImage.Width, image.Height - copyImage.Height, copyImage.Width, copyImage.Height), 0, 0, copyImage.Width, copyImage.Height, System.Drawing.GraphicsUnit.Pixel); g.Dispose();
image.Save(Path_syp); image.Dispose(); }