简体   繁体   English

在项目文件夹,Windows Phone 8.0,c#,xaml中存储图片

[英]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 您可以通过三种方式存储它

  1. Using Isolated Storage 使用隔离存储

    Here you just get the stream of the captured image and store it in Isolated Storage as shown here here 在这里,你刚才得到的拍摄图像的流,如下图所示将其存储在独立存储在这里

  2. 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(); } 
  3. 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.

相关问题 如何在“带有XAML的Windows Phone Direct3D”项目中从DirectX(C ++)到XAML(C#)进行通信 - How to communicate from DirectX (C++) to XAML (C#) in a “Windows Phone Direct3D with XAML” project 来自c#的xaml颜色(windows phone) - color in xaml from c#(windows phone) 如何使用XAML和C#从Windows Phone 8中的文件夹创建图库? - How can I create an image gallery from a folder in Windows Phone 8 using XAML and C#? 如何从我的Windows Phone 8应用程序(XAML和C#)访问相机并将拍摄的照片保存在确定的文件夹中? - How to access the camera from my Windows Phone 8 app (XAML and C#) and save the taken picture in a determined folder? 使用C#为Windows Phone 8.0编程录音机 - Programming Sound Recorder with c# for windows phone 8.0 如何获取网站的来源(Windows Phone 7.1 - 8.0)C# - how to get the source of a website in (Windows phone 7.1 - 8.0) C# Windows Phone 8.0中使用C#的TextBlock中的超链接 - Hyperlinks in TextBlock in windows phone 8.0 using C# Windows Phone 8.0上带有C#的线性渐变笔刷 - Linear gradient brush with c# on windows phone 8.0 从winForms移植到Windows Phone 8.0 C# - Port from winForms to Windows phone 8.0 C# C#Windows Phone XAML显示无效的XA​​ML错误 - C# windows phone xaml showing invalid xaml error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM