点样将Image直接转换成Byte()数组

allanli 2003-05-19 06:17:45
要求不通过中键介质,例如文件等,我现在有一个Image对象,想直接存到数据库里面,但数据库只接收byte()数组啊。
...全文
86 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
coollzh 2003-05-19
  • 打赏
  • 举报
回复
System.IO.FileStream fs= new System.IO.FileStream(strpath,System.IO.FileMode.Open);
System.IO.MemoryStream ms=new System.IO.MemoryStream(fs)
byte[] buffer =ms.getBuffer();
coollzh 2003-05-19
  • 打赏
  • 举报
回复
接上面代码
byte[] buffer =ms.getBuffer();
2002pine 2003-05-19
  • 打赏
  • 举报
回复
byte [] buff=new Byte[len];
System.IO.MemoryStream ms=new System.IO.MemoryStream(buff,true)
image1.Save(ms, ImageFormat.JPEG);

不记得怎么写,
思路是这样的,你把image转成stream,即可

16,550

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧