最近在给公安系统做系统,需要在图片上打上水银等等,好吧直接看代码
protected void SetPicDescription(string filePath)
{
if (System.IO.File.Exists(filePath))//看该路径下图片是否存在
{
string strDescription = "公安部水印测试";//文字描述
System.IO.MemoryStream ms = new System.IO.MemoryStream(System.IO.File.ReadAllBytes(filePath));
Image image = Image.FromStream(ms);
Graphics g = Graphics.FromImage(image);
GraphicsPath gp = new GraphicsPath();
//画图形填充区域开始
Rectangle rec = new Rectangle(new Point(500, 500), new Size(100, 100));
gp.AddEllipse(rec);
g.DrawRectangle(new Pen(Color.White), rec);
Color customColor = Color.FromArgb(255, Color.Gray);