Convertir una matriz de bytes o almacenamiento de archivos a imagen de mapa de bits
Después de seleccionar el archivo en el archivo de almacenamiento, ¿Cómo puedo convertir este archivo en una imagen para mostrarlo como la imagen de perfil?
Convertí el archivo a una matriz de bytes, pero no sé qué hacer a continuación o hay otra manera?
Aquí está mi código:
var openPicker = new Windows.Storage.Pickers.FileOpenPicker();
openPicker.ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.DocumentsLibrary;
openPicker.FileTypeFilter.Add(".png");
openPicker.FileTypeFilter.Add(".Jpeg");
openPicker.FileTypeFilter.Add(".Jpg");
StorageFile file = await openPicker.PickSingleFileAsync();
var stream = await file.OpenReadAsync();
using (var dataReader = new DataReader(stream))
{
var bytes = new byte[stream.Size];
await dataReader.LoadAsync((uint)stream.Size);
dataReader.ReadBytes(bytes);
var stream2 = new MemoryStream(bytes);
}