在Windows运行时从位图创建流

本文关键字:创建 位图 Windows 运行时 | 更新日期: 2023-09-27 18:07:54

我想从位图创建一个流。首先是:

Stream imgStream = typeof(Main).GetTypeInfo().Assembly.GetManifestResourceStream("ApplicationBlockBase.Assets.testimage.jpg");

但是现在我需要从本地图像创建一个流。你有什么主意吗?

谢谢你的时间,regards.

在Windows运行时从位图创建流

让我知道这是否有效。

StorageFile imageFile = await (await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("Assets")).GetFileAsync("testimage.jpg");
Stream imgStream = await imageFile.OpenStreamForReadAsync();