System.Drawing.Image image = System.Drawing.Image.FromFile("G:\\zt_tg.jpg");
using (Bitmap bmp = new Bitmap(image.Width, image.Height))
{
// 绘制验证码文本
using (Graphics g = Graphics.FromImage(bmp))
{
g.DrawImage(image, 0, 0, image.Width, image.Height);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
this.Response.ContentType = "image/png";
ms.WriteTo(this.Response.OutputStream);
ms.Close();
}
}
using (Bitmap bmp = new Bitmap(image.Width, image.Height))
{
// 绘制验证码文本
using (Graphics g = Graphics.FromImage(bmp))
{
g.DrawImage(image, 0, 0, image.Width, image.Height);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
this.Response.ContentType = "image/png";
ms.WriteTo(this.Response.OutputStream);
ms.Close();
}
}