In my application I am using WriteableBitmapRenderExtensions.Render()
method present in WinRT XAML toolkit for rendering xaml element. After rendering the xaml control I need to send this to server in the form of Base64 string. How I can convert this WritableBitmap class in to Base64 string?
Asked
Active
Viewed 545 times
1

Filip Skakun
- 31,624
- 6
- 74
- 100

user3064847
- 373
- 2
- 8
-
possible duplicate of [How to Convert a WriteableBitmap image to Byte array in WinRt App](http://stackoverflow.com/questions/16184254/how-to-convert-a-writeablebitmap-image-to-byte-array-in-winrt-app) – WiredPrairie Dec 10 '13 at 13:21
-
The given question is not marked as answered by the user, moreover I need to convert the WritableBitmap as Base64 string. – user3064847 Dec 10 '13 at 13:30
-
You can convert a byte array to a Base64 string -- there's not a direct path from WriteableBitmap to a Base64 string. – WiredPrairie Dec 10 '13 at 13:33
-
1See this for `byte[]` to base64 encoded string: http://stackoverflow.com/a/1134696/231316 – Chris Haas Dec 10 '13 at 14:34
1 Answers
1
Save the WriteableBitmap
to a png or jpg (there's an extension for that in the toolkit that you can probably modify to get the compressed image as byte array) to reduce the data size and then use Convert.ToBase64String()
as Chris suggested to convert the bytes to Base64 string.

Filip Skakun
- 31,624
- 6
- 74
- 100