2

How to save a WriteableBitmap to localfolder using C# in WinRT?

Andy Wan
  • 1,050
  • 2
  • 11
  • 23

2 Answers2

3

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

Filip Skakun
  • 31,495
  • 6
  • 72
  • 99
0

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.

Community
  • 1
  • 1
Mayank
  • 8,641
  • 4
  • 34
  • 58
  • 1
    That would lead to writing pixel data directly to a file though. Wouldn't you rather compress it to a well known format? – Filip Skakun Oct 24 '12 at 08:06