代码如下:///图片转二进制private byte[] convertByte(Image img){ MemoryStream ms = new MemoryStream(); img.Save(ms, img.RawFormat); //byte[] bytes = new byte[ms.Length]; //ms.Read(bytes, 0, Convert.ToInt32(ms.Length)); //以上两句改成下面两句 byte[] bytes = ms.ToArray(); ms.Close(); return bytes;}