/// <summary> /// 包含头部信息的图片数据转换成bitmapImage /// </summary> /// <param name="image"></param> /// <returns></returns> public static BitmapImage TotalByte2BitmapImage(Byte[] image) { if (image == null) { return null; } System.IO.MemoryStream ms = new System.IO.MemoryStream(image.ToArray()); BitmapImage bitImg = new BitmapImage(); try { bitImg.BeginInit(); bitImg.CacheOption = BitmapCacheOption.OnLoad; bitImg.StreamSource = ms; bitImg.EndInit(); bitImg.Freeze(); } catch (System.Exception ex) { throw ex; } finally { ms.Close(); ms.Dispose(); } return bitImg; }