字符串如何转成图片?

qingtianzhuren7 2012-06-20 06:00:04
   
public static byte[] BitmapToByte(Bitmap A_0)
{
if (A_0 == null)
{
return null;
}
BitmapData bitmapdata = A_0.LockBits(new Rectangle(new System.Drawing.Point(), A_0.Size), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
int length = bitmapdata.Stride * A_0.Height;
byte[] destination = new byte[length];
Marshal.Copy(bitmapdata.Scan0, destination, 0, length);
A_0.UnlockBits(bitmapdata);
return destination;
}

public static string ByteToStr(byte[] A_0)
{
if (A_0 == null)
{
return "";
}
string str = "";
if (A_0 != null)
{
for (int i = 0; i < A_0.Length; i++)
{
str = str + A_0[i].ToString("X2");
}
}
return str;
}

图片转化成字符串,是上面这样,但如何从得到的字符串转化回去呢??
...全文
157 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
孟子E章 2012-06-20
  • 打赏
  • 举报
回复
File.WriteAllBytes("c:\xx.jpg",A_0)

110,539

社区成员

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

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

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