Skip to content

Instantly share code, notes, and snippets.

@timheuer
Created September 9, 2012 04:45
Show Gist options
  • Save timheuer/3682645 to your computer and use it in GitHub Desktop.
Save timheuer/3682645 to your computer and use it in GitHub Desktop.
byte array to bitmap image
// assume 'img' is a byte[]
BitmapImage bmp = new BitmapImage();
using (var ras = new InMemoryRandomAccessStream())
{
var strm = ras.GetOutputStreamAt(0).AsStreamForWrite();
strm.Write(img, 0, img.Length);
bmp.SetSourceAsync(ras);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment