Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8875507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:59:24+00:00 2026-06-14T18:59:24+00:00

How can I load a bitmapImage from base64String in windows 8 ? I tried

  • 0

How can I load a bitmapImage from base64String in windows 8?

I tried this but I am not successful. It used to work on windows phone. What is different?

Looks like I have to use the function setsourceasync. When I use that, then I am required to pass the parameter as IRandomMemory which I am unable to do. How to do this?

    public static BitmapImage Base64ToImage(string base64String)
    {
        var bitmapImage = new BitmapImage();
        try
        {
            if (!String.IsNullOrEmpty(base64String))
            {
                var imageBytes = Convert.FromBase64String(base64String);
                using (var ms = new MemoryStream(imageBytes, 0, imageBytes.Length))
                {
                    bitmapImage.SetSourcec(ms);
                    return bitmapImage;
                }
            }
        }
        catch (Exception e)
        {

        }

        return null;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:59:25+00:00Added an answer on June 14, 2026 at 6:59 pm

    To create an IRandomAccessStream object for the SetSource method, you need to use a DataWriter. Take a look to this code:

        public async Task<BitmapImage> GetImage(string value)
        {
            if (value == null)
                return null;
    
            var buffer = System.Convert.FromBase64String(value);
            using (InMemoryRandomAccessStream ms = new InMemoryRandomAccessStream())
            {
                using (DataWriter writer = new DataWriter(ms.GetOutputStreamAt(0)))
                {
                    writer.WriteBytes(buffer);
                    await writer.StoreAsync();
                }
    
                var image = new BitmapImage();
                image.SetSource(ms);
                return image;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way that i can load the file from url, not from
I can do this within code to load a bitmapimage located on the Server
I can load the Color contents of the Current Window using GetDIBits but i
I can load COM DLLs that are registered on my machine like this: Type
I know we can load a Object from .class file and my question is
Apache Pig can load data from Hadoop sequence files using the PiggyBank SequenceFileLoader :
So I need a function to test if an image can load or not.
I use below code to load image from URL in my winodws phone 7
I can load a matrix from text file: load mydata.txt The problem is my
I am writing an app can load data from from web, then put the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.