//引入命名空间
//using System.Drawing;
//using System.Drawing.Drawing2D;
//using System.Drawing.Imaging;
//实例化Bitmap
Bitmap image = new Bitmap(300, 50);
//从bitmap实例创建Graphics实例
Graphics graphics = Graphics.FromImage(image);
//以黑色填充图片
graphics.Clear(Color.Black);
//定义绘制文字的字体和大小
Font font = new Font("宋体", 16);
//定义绘制文字的颜色
Brush brush = new SolidBrush(Color.White);
//绘制文字
graphics.DrawString("励志工作室", font, brush, 0, 0);
//释放Graphics对象
graphics.Dispose();
Response.Clear();
Response.ContentType = "image/pjpeg";
//将图片保存到Response的输出流中
image.Save(Response.OutputStream, ImageFormat.Jpeg);
//写入到Response输出流中
image.Dispose();
Response.End();