[英]how to Customize windows 8.1 camera app for C# wpf application
I am creating WPF application, for my webcam section am using built-in metro camera app. 我正在创建WPF应用程序,对于我的网络摄像头部分,我正在使用内置的Metro Camera应用程序。 Since this application is an Desktop application, i just want to use Metro Camera app for the sake of capturing Image and editing.
由于此应用程序是桌面应用程序,因此我只想使用Metro Camera应用程序来捕获图像并进行编辑。 After capturing the images its getting saved in This PC-->Pictures folder, but i want to save the images in some other folder and also i want to give a name for the images manually.
捕获图像后,将其保存在“本机”->“图片”文件夹中,但是我想将图像保存在其他文件夹中,并且我也想手动为图像命名。 Is there any way to do this?
有什么办法吗?
Here is the code for saving images : 这是保存图像的代码:
void SaveToBmp(FrameworkElement visual, string fileName)
{
var encoder = new BmpBitmapEncoder();
SaveUsingEncoder(visual, fileName, encoder);
}
void SaveToPng(FrameworkElement visual, string fileName)
{
var encoder = new PngBitmapEncoder();
SaveUsingEncoder(visual, fileName, encoder);
}
// and so on for other encoders (if you want)
void SaveUsingEncoder(FrameworkElement visual, string fileName, BitmapEncoder encoder)
{
RenderTargetBitmap bitmap = new RenderTargetBitmap((int)visual.ActualWidth, (int)visual.ActualHeight, 96, 96, PixelFormats.Pbgra32);
bitmap.Render(visual);
BitmapFrame frame = BitmapFrame.Create(bitmap);
encoder.Frames.Add(frame);
using (var stream = File.Create(fileName))
{
encoder.Save(stream);
}
}
Here is the source for that. 这是它的来源。
Update : 更新:
If you want to save images in metro app
you can use Pictures Library
for that. 如果要将图像保存在
metro app
,则可以使用Pictures Library
。
Read these following questions for that : 为此,请阅读以下问题:
Download and Save image in Pictures Library through Windows 8 Metro XAML App 通过Windows 8 Metro XAML App将图片下载并保存到图片库中
How save photo capture windows 8 c# metro app? 如何保存照片捕获Windows 8 C#Metro应用程序?
Hope it helps. 希望能帮助到你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.