I\'m able to convert a byte[] to an image:
byte[] myByteArray = ...; // ByteArray to be converted
MemoryStream ms = new MemoryStream(my);
BitmapImage bi =
public static void Save(this BitmapSource bitmapSource, Stream stream)
{
var writeableBitmap = new WriteableBitmap(bitmapSource);
for (int i = 0; i < writeableBitmap.Pixels.Length; i++)
{
int pixel = writeableBitmap.Pixels[i];
byte[] bytes = BitConverter.GetBytes(pixel);
Array.Reverse(bytes);
stream.Write(bytes, 0, bytes.Length);
}
}
public static void Load(this BitmapSource bitmapSource, byte[] bytes)
{
using (var stream = new MemoryStream(bytes))
{
bitmapSource.SetSource(stream);
}
}
public static void Load(this BitmapSource bitmapSource, Stream stream)
{
bitmapSource.SetSource(stream);
}