asp.net在图片上增加文字水印

string Path;
        string Path_sy;
        Path = Server.MapPath(".") + "\\" + "QQ.Jpg";
        Path_sy = Server.MapPath(".") + "\\" + "QQ1.Jpg";
        string addText = "测试水印";
        System.Drawing.Image image = System.Drawing.Image.FromFile(Path);
        System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(image);
        g.DrawImage(image, 0, 0, image.Width, image.Height);
        System.Drawing.Font f = new System.Drawing.Font("Verdana", 16);
        System.Drawing.Brush b = new System.Drawing.SolidBrush(System.Drawing.Color.Blue);

        g.DrawString(addText, f, b, 15, 15);
        g.Dispose();

        image.Save(Path_sy);
        image.Dispose();

posted @ 2007-09-13 16:55  宿远  阅读(295)  评论(0)    收藏  举报