Hi,
you saving multiple bitmaps into one MemoryStream. If you want to work this, you need to create byte[][] instead of byte[]. Image.FromStream returns only one image.
private byte[][] BitmapToByteArray(List<Bitmap> bmp)
{
var res = new List<byte[]>();
foreach (Bitmap item in bmp)
{
using (var ms = new MemoryStream())
{
item.Save(ms, ImageFormat.Bmp);
res.Add(ms.ToArray());
}
}
return res.ToArray();
}
private List<Bitmap> ByteToBitmapList(byte[][] byteArrayIn)
{
var res = new List<Bitmap>();
foreach (byte[] img in byteArrayIn)
{
using (var ms = new MemoryStream(img))
{
var bitmap = (Bitmap)Image.FromStream(ms);
res.Add(bitmap);
}
}
return res;
}
Hope this helps,
Michal