0

在 WP 8 中,我曾经PhotoCamera制作相机应用程序并将图像保存在相机胶卷中,我使用了以下方法:

private void cam_CaptureImageAvailable(object sender, ContentReadyEventArgs e)
{
    string fileName = "photo.jpg";
    MediaLibrary library = new MediaLibrary();
    library.SavePictureToCameraRoll(fileName, e.ImageStream);
}

在 WPSL 8.1 中,我使用并且使用相同的样式将图像保存在相机胶卷中,MediaCapture但我不知道如何ImageStreamMediaCapture. e.ImageStream即使使用其他编程风格保存到相机胶卷,我也愿意接受建议。

4

1 回答 1

0
        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 应用程序中获取的,用于将图像保存到存储中,然后将其作为流从磁盘中读取。我从来没有能够直接将图像捕获为流。

于 2016-03-24T16:08:21.933 回答