文字水印

 

using System.Threading.Tasks;
using System.IO;
using System.Drawing;

 

public static int Shuy(string Sname,string fname)
{
try
{
Image image = Image.FromFile(fname);
Graphics gra = Graphics.FromImage(image);
String text = Sname;
Font font = new Font("宋体", 26);
SizeF size = new SizeF();
SolidBrush seli = new SolidBrush(Color.FromArgb(220, 220, 0, 0));
gra.DrawString(text, font, seli, new PointF(image.Width / 5, image.Height / 2 - size.Height / 2));
image.Save(@"E:\高四\日考\Zk2\Zk2\haha\lala11.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
return 1;
}
catch (Exception)
{
return 0;
throw;
}

}

posted @ 2017-11-23 10:50  嗯哼,还好  阅读(96)  评论(0编辑  收藏  举报