[英]Storing a Pic in The project folder, windows Phone 8.0, c#, xaml
I want to take a picture with the CameraCaptureTask, and then save it in a specific folder, in my Project(!). 我想用CameraCaptureTask拍照,然后将其保存在我的Project(!)中的特定文件夹中。 I found some Tutorials, where you can save a pic in the MediaLibrary.
我找到了一些教程,您可以在其中将图片保存在MediaLibrary中。 But i want to store it right in the Project.
但我想将其存储在项目中。 I have the Image as a Bitmap in my code, just have to save it now.
我在代码中将图像作为位图,只需要立即保存即可。 I would really apreciate a tip.
我真的很感激小费。 thanks
谢谢
You can store it in three ways 您可以通过三种方式存储它
Using Isolated Storage 使用隔离存储
Here you just get the stream of the captured image and store it in Isolated Storage as shown here here 在这里,你刚才得到的拍摄图像的流,如下图所示将其存储在独立存储在这里
Using Memory Stream 使用内存流
Here you store the captured image stream in the memory 在这里,您将捕获的图像流存储在内存中
using (MemoryStream stream = new MemoryStream()) { bitmap2.SaveJpeg(stream, width, height, 0, 100); //Don't change other unless necessary stream.Close(); }
Using Local Folder Storage 使用本地文件夹存储
Here you save the captured image stream in Local Folder of your App 在这里,您将捕获的图像流保存在应用程序的本地文件夹中
StorageFile sampleFile = await dataFolder.CreateFileAsync("image.png"); await FileIO.WriteBytesAsync(sampleFile, capturedImageStream);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.