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 377449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T14:41:51+00:00 2026-05-12T14:41:51+00:00

I have edited this question to make it easier to understand. I have an

  • 0

I have edited this question to make it easier to understand.

I have an image file and I have to store the image data into an existing file in binary. And when that file gets opened in my program again, that binary data should be somehow read and that image displayed inside a picturebox. How would I go about doing this in C#?

Any help/suggestions much appreciated.

Thank you
jase

EDIT:

Because our files are of the following structure:

Control
"Text here"
Location

…And there will be many cases where there are more than one or a few controls in the same file like so:

Label
"This is a label"
23, 44
Label
"This is another label"
23, 64
LinkLabel
"This is a linkLabel"
23, 84

…

I don’t know where to place/save the following code:

Maybe inside the file like so…:

Image
"<controlLocationData type="Image">
  <Data>
    Base64 encoded image data here
  </Data>
  <FreeformLocation>60, 40</FreeforLocation>
</controlLocationData>"
60, 40

and then use this code below to save/load and display the image?…

var image = LoadBitMap("My Bitmap");
var stream = new MemoryStream();
image.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp);
string base64Encoded = Convert.ToBase64String(stream.ToArray());
  • 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-05-12T14:41:52+00:00Added an answer on May 12, 2026 at 2:41 pm

    I would probably be inclined just create a block of base64 text in your file that represents the BMP bits.

    Edit:

    Looks like you are already on the right track here, I find that with these types of conversions, a couple of extension methods are pretty handy…

    public static string ToBase64String(this Bitmap bm)
    {
      MemoryStream s = new MemoryStream();
      bm.Save(s, System.Drawing.Imaging.ImageFormat.Bmp);
      s.Position = 0;
      Byte[] bytes = new Byte[s.Length];
      s.Read(bytes, 0, (int)s.Length);
      return Convert.ToBase64String(bytes);
    }
    
    public static Bitmap ToBitmap(this string s)
    {
      Byte[] bytes = Convert.FromBase64String(s);
      MemoryStream stream = new MemoryStream(bytes);
      return new Bitmap(stream);
    }
    

    The format of your text file is no big deal, you just need to be able to index into it for your data, so Xml is a common format, but as I said, its just a case of finding the base64 block that you are after.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

--edited for clarity (hopefully) I have an XML file that looks something like this:
Note: I edited this question to make it easier for other people with the
I have edited this post with my question writen in a more simple way
I have edited and simplified this question a lot. If I have this method
** This question has been edited to make it simpler and more focused **
[Editor's note: I have edited the title to try to make this useful to
I have some code that reads a file into an array of lines, and
i have an edited version of a config file specific for my machine. i
I have a spreadsheet that is edited by multiple users. To prevent tampering with
I just edited an .SWF file I have on my website home page for

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.