8,757
社区成员
发帖
与我相关
我的任务
分享
private static BitmapImage ByteArrayToBitmapImage(byte[] byteArray)
{
BitmapImage bmp = null;
try
{
var ms = new System.IO.MemoryStream(byteArray);
bmp = new BitmapImage();
bmp.BeginInit();
bmp.CacheOption = BitmapCacheOption.OnLoad;
bmp.StreamSource = ms;
bmp.EndInit();
bmp.Freeze();
ms.Close();
}
catch
{
bmp = null;
}
return bmp;
}