在WP8中,我使用PhotoCamera制作了一个相机应用程序,并将图像保存在相机胶卷中,我使用了以下方法:
private void cam_CaptureImageAvailable(object sender, ContentReadyEventArgs e)
{
string fileName = "photo.jpg";
MediaLibrary library = new MediaLibrary();
library.SavePictureToCameraRoll(fileName, e.ImageStream);
}在WPSL8.1中,我使用MediaCapture并使用相同的样式将图像保存在相机胶卷中,但我不知道如何像在e.ImageStream中那样从MediaCapture中检索ImageStream。我是开放的建议,甚至与其他编程风格保存到相机卷。
发布于 2016-03-25 00:08:22
var file = await Windows.Storage.KnownFolders.PicturesLibrary.CreateFileAsync(IMAGECAPTURE_FILENAME, Windows.Storage.CreationCollisionOption.ReplaceExisting);
await _exceptionHandler.Run(async () =>
{
await _mediaCapture.CapturePhotoToStorageFileAsync(_imageEncodingProperties, file);
var photoStream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
await bitmap.SetSourceAsync(photoStream);
});上图取自UWP应用程序,用于将图像保存到存储中,然后以流的形式从磁盘读取。我从来没有能够直接以流的形式捕获图像。
https://stackoverflow.com/questions/36204607
复制相似问题