How to save a WriteableBitmap to localfolder using C# in WinRT?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You can check WinRT XAML Toolkit for a set of extension methods to do exactly what you need: http://winrtxamltoolkit.codeplex.com/SourceControl/changeset/view/0657c67a93d5#WinRTXamlToolkit%2fImaging%2fWriteableBitmapSaveExtensions.cs
回答2:
Here are bits and pieces of the answer
var bitmap = new WriteableBitmap(width,height);
var stream = bitmap.PixelBuffer.AsStream();
than you can get IOutputStream
from Stream
to write the data into the local folder.
this post explains how to convert Stream
to byte[]
and this explains how to write byte[]
array to localfolder.