主题:C# 流和图象之间转换
kaixin1
[专家分:0] 发布于 2006-09-27 09:32:00
谁能给个C# 图片转化成流 流再转化成图片的代码!
谢谢
回复列表 (共1个回复)
沙发
yizhinantian [专家分:640] 发布于 2006-09-28 10:36:00
FileStream FS = new FileStream(@"E:\Pictures\Animal\a.gif",FileMode.Open,FileAccess.Read);
byte[] buff = new byte[FS.Length+1];
int i = FS.Read(buff,0,(int)FS.Length);
if( i<FS.Length)
{
Response.Write("Error");
}
Response.ContentType = "image/gif";
Response.BinaryWrite(buff);
我来回复