输入流是无效的二进制格式。大佬们救救我的头发吧

Riven_mikasa 2020-07-29 10:09:24
大佬们救救我头发吧T.T
后端:
前端:
莫名其妙,但是就是错了。照着网上来的也是错的T.T,实在是想不到哪里有问题了T.T
...全文
3843 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
张元浩_HY 2020-08-02
  • 打赏
  • 举报
回复 1
图像->byte[]->ToBase64String->字符串string->FromBase64String->byte[]->图像 图像->BinaryFormatter.Serialize->二进制序列化byte[]->BinaryFormatter.Deserialize->图像 所以二者相对于两种不同的编码方式。
Riven_mikasa 2020-07-30
  • 打赏
  • 举报
回复
引用 1 楼 front333 的回复:

byte[] buffer = Convert.FromBase64String(base64);
using (MemoryStream ms = new MemoryStream(buffer))
{
Bitmap bmp = new Bitmap(ms);
}
卧槽,大佬,为什么这样就可以了咧,原理是啥,卧槽,太牛皮了,卧槽感受到温暖了。我激动得不知道说什么了T.T(泪流满面)
张元浩_HY 2020-07-29
  • 打赏
  • 举报
回复

byte[] buffer = Convert.FromBase64String(base64);
using (MemoryStream ms = new MemoryStream(buffer))
{
Bitmap bmp = new Bitmap(ms);
}

110,537

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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