I guess to want to convert memory stream to imagebrush
using (var stream = new MemoryStream(data))
{
var bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.StreamSource = stream;
bitmap.CacheOption = BitmapCacheOption.OnLoad;
bitmap.EndInit();
bitmap.Freeze();
}
now you can this bitmapimage as a source to an image.
The BitmapCacheOption.OnLoad is important in this case because otherwise the BitmapImage might try to access the stream when loading on demand and the stream might already be closed.
Freezing the bitmap is optional but if you do freeze it you can share the bitmap across threads which is otherwise impossible.
Reference :
http://stackoverflow.com/questions/5346727/convert-memory-stream-to-bitmapimage[
^]
Also refer this
https://social.msdn.microsoft.com/Forums/vstudio/en-US/8327dd31-2db1-4daa-a81c-aff60b63fee6/converting-an-imagebitmapimage-object-into-byte-array-and-vice-versa?forum=wpf[
^]