C# Graphics给图片添加水印
原图 效果图
Image img = Image.FromFile(imgFile);
using (Graphics g = Graphics.FromImage(img))
{
// 画水印
if (!String.IsNullOrWhiteSpace(this.Mask))
{
Font drawFont = new Font(FamilyName, 12f);
SolidBrush drawBrush = new SolidBrush(Color.FromArgb(75, Color.White));
g.DrawString(this.Mask, drawFont, drawBrush, 243, 158);
}
// 写文本
if (!String.IsNullOrWhiteSpace(keyword))
{
Font drawFont = new Font(FamilyName, 20f, FontStyle.Bold);
SolidBrush drawBrush = new SolidBrush(Color.White);
g.DrawString(keyword, drawFont, drawBrush, 240, 122);
}
}
版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
post YES开发框架