Подтвердить что ты не робот

Получение изображений из Memorystream в С# wpf

Как я могу получить ImageSource из MemoryStream в WPF с помощью С#? или преобразовать MemoryStream в ImageSource, чтобы отобразить его как изображение в wpf?

4b9b3361

Ответ 1

using (MemoryStream memoryStream = ...)
{
    var imageSource = new BitmapImage();
    imageSource.BeginInit();
    imageSource.StreamSource = memoryStream;
    imageSource.EndInit();

    // Assign the Source property of your image
    image.Source = imageSource;
}