picture.image转换为byte[] 大家好,有人能告诉我怎么能把pictureBox.image直接转换为byte[]格式吗如果不能直接转化,间接转换也可以的谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 MemoryStream imgStream = new MemoryStream(); pic.Save(imgStream, System.Drawing.Imaging.ImageFormat.Bmp);//pic为bitmap类型的对象 byte[] imageb ={ }; imageb = imgStream.ToArray(); 谢谢你,我一直以为picture.image是个image对象呢,结果试了好几种转换也没有成功 保存到文件里再读出来this.pictureBox.Image.Save("file"); pic.Save(imgStream, System.Drawing.Imaging.ImageFormat.Bmp);改为pic.Save(imgStream, System.Drawing.Imaging.ImageFormat.gif);也可以吧 System.Drawing.Image img = this.pictureBox1.Image; System.IO.MemoryStream ms = new System.IO.MemoryStream(); img.Save(ms, img.RawFormat); byte[] by = new byte[ms.Length ]; ms.Position = 0; ms.Read(by, 0, (int)ms.Length); 如何测后台线程的运行时间 C#Socket通信问题 tabcontrol 问题 存储过程中临时表的问题 在网页添加一个按钮,将页面上的字段信息导入另一个服务器的数据库 刚开始用C#(winForm)做控件,想做一个圆角的的窗体,但是现在只会做方角的.还请各位高手帮忙. 循环删除???大哥帮忙,急急急急急急急! 简单问题,80分赠送 如何发行我在.NET下开发的应用程序到没有安装.NET Framework的机器上运行? 如何使用C#生成zip格式文件。 有两句语法不明白,帮解释一下。 关于mdi子窗体的子窗体的问题?
pic.Save(imgStream, System.Drawing.Imaging.ImageFormat.Bmp);//pic为bitmap类型的对象
byte[] imageb ={ };
imageb = imgStream.ToArray();
this.pictureBox.Image.Save("file");
改为
pic.Save(imgStream, System.Drawing.Imaging.ImageFormat.gif);
也可以吧
System.IO.MemoryStream ms = new System.IO.MemoryStream();
img.Save(ms, img.RawFormat);
byte[] by = new byte[ms.Length ];
ms.Position = 0;
ms.Read(by, 0, (int)ms.Length);