public static System.Windows.Controls.Image ByteArrayToImage(byte[] bytesImg) { System.Windows.Media.Imaging.BitmapImage bitmapImage = new System.Windows.Media.Imaging.BitmapImage(); bitmapImage.BeginInit(); bitmapImage.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad; bitmapImage.StreamSource = new MemoryStream(bytesImg); bitmapImage.EndInit(); System.Windows.Controls.Image img = new System.Windows.Controls.Image(); img.Source = bitmapImage; return img; }