/// <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(); }
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。