/// <summary>
/// image to byte[]
/// </summary>
public byte[] BytesToImage(Image ImgPic)
{
if (ImgPic!=null)
{
MemoryStream Stream = new MemoryStream();
model.Photo.Save(Stream, System.Drawing.Imaging.ImageFormat.Jpeg);
return Stream.GetBuffer();
}
}
/// <summary>
/// byte[] to image
/// </summary>
public byte[] BytesToImageToBytes(byte[] by)
{
if (ds.Tables[0].Rows[0]["Photo"].ToString() != "")
{
MemoryStream Stream = new MemoryStream((byte[])by);
return Image.FromStream(Stream);
}
}
/// image to byte[]
/// </summary>
public byte[] BytesToImage(Image ImgPic)
{
if (ImgPic!=null)
{
MemoryStream Stream = new MemoryStream();
model.Photo.Save(Stream, System.Drawing.Imaging.ImageFormat.Jpeg);
return Stream.GetBuffer();
}
}
/// <summary>
/// byte[] to image
/// </summary>
public byte[] BytesToImageToBytes(byte[] by)
{
if (ds.Tables[0].Rows[0]["Photo"].ToString() != "")
{
MemoryStream Stream = new MemoryStream((byte[])by);
return Image.FromStream(Stream);
}
}