Turn a Base64 encoded string into a .png image using ASP

Posted on 2006-06-06
Last Modified: 2008-02-01
Hello everyone,

I am using the FedEx ship manager direct system to get shipping labels.  They send me the .PNG labels encoded in Base64.  How can I convert these Base64 strings into .PNG images that will display in a web browser?

Thank you in advance for your help...
Question by:greatseats
    LVL 25

    Accepted Solution

    is it a string they are sending you, or the actual .png file?

    there are a few decrypt/encrypt Base64 classic ASP functions, one in particular comes to mind:

    if they are sending you the file, I would imagine you would have to have their certificate installed to be able to open the file.  I'm unsure of your email client so I can't even begin to tell you how to do it....  I would think they would send you the certificate with it, but I don't have a use for using their system

    Author Comment

    They are sending me the .PNG label encoded in Base64 via XML.  Here is an excerpt of the encoded string:


    I can turn the Base64 string into a .PNG file and view it successfully using other programs; I need to know how to do it with ASP code on my web server.

    LVL 25

    Expert Comment

    usually on things that come in your email that is encrypted come with a digital signature or some kind of certificate, if it came directly from FedEx, I am sure they have one that you will need to install.  These certificates usually come signed, and you will need that signature to open it from the email

    i don't know what you are talking about by string.  What does the email they send you look like? is this part of a link? is it just some stuff at the bottom of the email, or is there a .png file attached to the email?

    Author Comment

    They are the sending me the .PNG label encoded in Base64 via XML.  Here is an excerpt from the XML file they send me:


    Naturally, that is not the entire string.  I shortened it for this post.

    I can take the Base64 they send me and easily turn it into a .PNG on my computer.  What I am looking for is a way to convert the Base64 into an image (shippinglabel.png) on my web server using .ASP.

    Thanks for all the help so far, I will try to answer questions as best I can.

    Author Comment

    kevp75, thanks!

    The first time I looked at the code in that link you provided it didn't do much for me.  However now it's over a month later and I've learned a lot more.  A little bit of tweaking on my part and I was able to get it to work.  I use the filesystemobject to save it as a png - works great.  Thanks, you're a lifesaver - I'm just slow on the uptake.
    LVL 25

    Expert Comment

    awesome.  Glad to hear it worked out  :)

    thanks for the grade

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now