Often see the mop on the person posted that dynamic picture, that is, a string as a parameter to a Dynamic Web page, will generate a picture with this string, this is called a text watermark. Like what the original Panda series, as well as the later trees and gold bars, are very interesting. I wrote a very simple one with ASP. The entire code is as follows:
<%@ Import namespace= "System"%>
<%@ Import Namespace= "System.IO"%>
<%@ Import namespace= "System.Drawing"%>
<%@ page language= "VB"%>
<script runat= "Server" >
Dim FilePath as String = Server.MapPath ("talk.jpg")
Sub Page_Load (Sender as Object, E as EventArgs)
Dim image as System.Drawing.Image = System.Drawing.Image.FromFile (FilePath)
Dim g as Graphics = graphics.fromimage (image)
G.drawimage (image, 0, 0, image. Width, image. Height)
Dim f as Font = new Font ("XXFarEastFont-Xingkai", 40)
Dim B as Brush = new SolidBrush (color.black)
Dim s as String = Left (Request.QueryString ("str"), 7)
g.DrawString (S, F, B, 20, 190)
Image. Save (Response.outputstream, System.Drawing.Imaging.ImageFormat.Jpeg)
G.dispose ()
Image. Dispose ()
End Sub
</script>
Just save this code as an ASPX file, such as Test.aspx. Then put it in the wwwroot (assuming your virtual directory is the default). Then make a talk.jpg picture, you can print the "Chinese Xingkai" in this place (20, 190) The text of the font. The invocation method is simple:
Http://localhost/Test.aspx?str= Test for a moment!
You can set the print location and font as well as the picture file. In addition, if an E is displayed as a parameter, and for Chinese, it is because the Web. config setting is incorrect, the following settings are required:
<?xml version= "1.0" encoding= "Utf-8"?>
<configuration>
<system.web>
<globalization requestencoding= "gb2312" responseencoding= "gb2312" culture= "ZH-CN" fileencoding= "gb2312"/>
</system.web>
</configuration>
This way, it can be displayed normally.
Implement simple text watermark with ASP.