byte[]数据里面没有文件头,只有数据,但复制到bitmap里后,图像错位了,怎么解决?
图像是31*31,16位1a5r5g5b
请给个.net 平台下的解决办法
byte[] bb;
System.IO.MemoryStream ms = new System.IO.MemoryStream(bb);
System.Drawing.Bitmap image = new System.Drawing.Bitmap(31, 31);
image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
context.Response.ClearContent();
context.Response.ContentType = "image/Jpeg";
context.Response.BinaryWrite(ms.GetBuffer());
ms.Close();
ms = null;
image.Dispose();
image = null;
你把这个图像输出到页面上,看看还错不错位
Bitmap b = new Bitmap("test.bmp");
MemoryStream ms = new MemoryStream();
b.Save(ms,System.Drawing.Imaging.ImageFormat.Bmp);
byte[] bytes= ms.ToArray();
b.Save("c:\\dd3.jpg");
byte[] bytelist=bytes;
MemoryStream ms1 = new MemoryStream(bytelist);
Bitmap bm = (Bitmap)Image.FromStream(ms1);
bm.Save("c:\\dd4.jpg");