RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Image To Base64 String Converter

Sythen

Sorceror
I've been working on a repository project for some time now and I like to conform scripts to blend in with that project; my OCD runs wild sometimes, what can I say?! Lol.

Anyway I was installing WatchUO into the project the other day and I say to myself, "geez man, the icon on the application is a default icon for when a developer doesn't assign a custom one and the logo on the 'About' tab lacks the kind of pristine beauty I've come accustomed to..." :)

So... changing the Windows Form Application icon was easy enough: all I had to do is open up the 'MainForm.cs' and replace the application's default icon icon line with this one:

Code:
public MainForm()
        {
            ...
 
            // This Overrides The Default Icon And Will Allow A Custom Icon
            this.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);

Then... I wracked my brain a little; it took the help of a really good friend to get me through the next part. I wanted to change that logo on the 'About' tab, but I noticed that the application did not load the logo from a traditional picture file. Instead someone had turned a picture into a string of Numbers, Letters, and symbols! Who would do such a thing?!

This took a little finagling, but I finally narrowed down my options. This unnamed friend (because I don't know if he wants me to identify him) and I began brainstorming and he says to me, "Okay I've got a solution, lets open up Visual Studio and you're going to write a little Windows Form Application program..." :) - And that's what we did.

So now I've got an Image To Base64 String Converter and I thought someone else could benefit from it. You could use it to do what I've done with WatchUO or... you could use it to embed images into web pages or another application. If you simply want to change the logo in WatchUO you can just do the following:

Code:
try
            {       
                this.pictureBox1.Image = Base64ToImage(@" <paste your Base64 Image String here> ");       
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            this.pictureBox1.Location = new System.Drawing.Point(16, 32);
            this.pictureBox1.Name = "RunUO-Logo";

Note: That when pasting your Base64 Image String that line and everything else below it will turn black in color, this is normal and okay; don't freak out. lol ;)

Its very simple to use: Launch the application and Click Open (Picture Below)



...And Now Select An Image File You Want To Convert:



and Copy the output from the gump/window of the Application:



You paste the output above into the a script or web page of your choice.

Enjoy! :)
 

Attachments

  • ImageConverter.rar
    94.3 KB · Views: 0
Top