yulei

给图片加水印 文字水印

同于工作需要,研究了下动态给图片加文字水印,并且实现了加透明文字。还可以应用于动态生成图片验证码等       

      string path = Server.MapPath(".") + @""images"xiaoyu.jpg";

        System.Drawing.Image img=System.Drawing.Image.FromFile(path);
       Graphics g = Graphics.FromImage(img);
       g.DrawImage(img, 0, 0, img.Width, img.Height);
       Font f = new Font("华文行楷", 36);
       //Brush br = new SolidBrush(Color.Red);
        Brush br=new SolidBrush(Color.FromArgb(80,255,0,0));
        g.DrawString("test",f,br,10,10);
        g.Dispose();
        img.Save(Server.MapPath(".") + @""images"xiaoyu_good.jpg");
        img.Dispose();
        Image1.ImageUrl = "images/xiaoyu_good.jpg";

分类:

技术点:

相关文章:

  • 2021-07-24
  • 2022-12-23
  • 2021-06-04
  • 2021-10-17
  • 2021-12-03
  • 2021-10-16
猜你喜欢
  • 2021-12-26
  • 2021-12-15
  • 2022-12-23
  • 2021-12-15
  • 2021-11-17
  • 2021-06-29
相关资源
相似解决方案