private byte[] getBytes(string imgpath)
{
try
{
if (string.IsNullOrEmpty(imgpath)) { return null; }
else
{
//将图片转换成二进制流
FileStream stream = new FileStream(imgpath, FileMode.Open);
byte[] imgdata = new byte[stream.Length];
stream.Read(imgdata, 0, imgdata.Length);
stream.Dispose();
//将二进制流转换成图片
//MemoryStream ms = new MemoryStream(imgdata);
//Image returnImage = Image.FromStream(ms);
//this.pictureBox1.Image = returnImage;
return imgdata;
}
}
catch (System.Exception ex)
{
return null;
}
}