Byte[] To Image

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;
}
Categoriec#

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *