首页 > 代码库 > asp.net 做文字水印
asp.net 做文字水印
/// <summary> /// 做图片水印(Drawing,IO) /// </summary> /// <param name="InPath">输入图片模板路径</param> /// <param name="OutPath">输入图片路径</param> /// <param name="oneStr">第1行文字</param> /// <param name="oneScript">1-字体</param> /// <param name="oneSize">1-字体大小</param> /// <param name="oneX">1-x坐标</param> /// <param name="oneY">1-y坐标</param> /// <param name="twoStr">第2行文字</param> /// <param name="twoScript">2-字体</param> /// <param name="twoSize">2-字体大小</param> /// <param name="twoX">2-x坐标</param> /// <param name="twoY">2-y坐标</param> private void MyGraphics(string InPath, string OutPath, string oneStr, string oneScript, int oneSize, int oneX, int oneY, string twoStr, string twoScript, int twoSize, int twoX, int twoY) { string one = oneStr; string two = twoStr; MemoryStream ms = new MemoryStream(); Bitmap bmp = new Bitmap(Server.MapPath(InPath)); Graphics g = Graphics.FromImage(bmp); g.DrawString(one, new Font(oneScript, oneSize), Brushes.White, new Point(oneX, oneY)); g.DrawString(two, new Font(twoScript, twoSize), Brushes.White, new Point(twoX, twoY)); bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); System.Drawing.Image i = System.Drawing.Image.FromStream(ms); i.Save(OutPath); g.Dispose(); bmp.Dispose(); }
本文出自 “程序猿的家” 博客,请务必保留此出处http://962410314.blog.51cto.com/7563109/1435290
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。