1

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?

4
  • possible duplicate of How to Convert a WriteableBitmap image to Byte array in WinRt App Commented Dec 10, 2013 at 13:21
  • The given question is not marked as answered by the user, moreover I need to convert the WritableBitmap as Base64 string. Commented Dec 10, 2013 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. Commented Dec 10, 2013 at 13:33
  • 1
    See this for byte[] to base64 encoded string: stackoverflow.com/a/1134696/231316 Commented Dec 10, 2013 at 14:34

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.