图片的数据库存取

//将图片转化为字节流       
public static byte[] bmpTobyte(System.Drawing.Bitmap image)
        {
                System.IO.MemoryStream stream
= new System.IO.MemoryStream();
                image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
               
return stream.ToArray();
        }

 

//字节流转化为IMAGE类型      
public static System.Drawing.Bitmap byteTobmp(byte[] bye)
        {
           
            System.IO.MemoryStream stream
= new System.IO.MemoryStream(bye);
            System.Drawing.Bitmap bmp
= new System.Drawing.Bitmap(stream);
           
return bmp;
        }
   

你可能感兴趣的:(图片的数据库存取)