It really depends on what is in the blob . Is it a valid bitmap image format (e.g. PNG, BMP, GIF, etc.?). If this is raw byte information about the pixels in a bitmap, you cannot do so.
This can help rewind the stream with mStream.Seek(0, SeekOrigin.Begin) before the Bitmap bm = new Bitmap(mStream); string Bitmap bm = new Bitmap(mStream); .
public static Bitmap ByteToImage(byte[] blob) { using (MemoryStream mStream = new MemoryStream()) { mStream.Write(blob, 0, blob.Length); mStream.Seek(0, SeekOrigin.Begin); Bitmap bm = new Bitmap(mStream); return bm; } }
source share