I am creating WPF application, for my webcam section am using built-in metro camera app. Since this application is an Desktop application, i just want to use Metro Camera app for the sake of capturing Image and editing. 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?
Asked
Active
Viewed 348 times
1
-
Did the updated answer work for you? – Ali Vojdanian Mar 02 '15 at 13:13
-
[this](http://stackoverflow.com/questions/16858376/download-and-save-image-in-pictures-library-through-windows-8-metro-xaml-app) is not working... – Mar 02 '15 at 13:36
-
It should worked. You probably do something wrong somewhere. Try to review again and also read the other link. – Ali Vojdanian Mar 02 '15 at 16:22
1 Answers
1
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.
Read these following questions for that :
Download and Save image in Pictures Library through Windows 8 Metro XAML App
How save photo capture windows 8 c# metro app?
Hope it helps.

Community
- 1
- 1

Ali Vojdanian
- 2,067
- 2
- 31
- 47
-
@Ranjith I already answered that question. You only need to get images then you can easily use the codes for saving images. – Ali Vojdanian Mar 02 '15 at 07:28
-
actually am using built in metro app, its a seperate process, how can i change that path of saving images as per my requirement? – Mar 02 '15 at 07:42
-
i am not developing Metro app (windows store app), am creating Wpf application which will be use for Tablet devices, am using Built-in metro app that is Camera app for taking pictures. My question is can i save the images which is taken by metro camera app in some other folder with custom name? – Mar 12 '15 at 06:21