bkiahg has asked for the wisdom of the Perl Monks concerning the following question:

Been awhile, but once again I come seeking direction from the wise monks here...

I have a program that’s communicating through the internet and part of the message that I receive is an image. The problem is it’s an imbedded image inside an xml file. So it looks like:
iVBORw0KGgoAAAANSUhEUgAAAp0AAAIvAQMAAAAMGfIDAAAABlBMVEX+/v4DAwOrIPIuAA +AA CXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH2AYFEDoPIxdR6AAAIABJREFUeJztnW9sHM +d1 wGdvV9yTLXOPshwzAcM9SW4lF25DuU7BpIx3JZ9qwogdu3EBGyhQJqmTtp/o9EOZguUuxY +so qY6pOHLrBm5MC0YC9FOCfjXipShETlLAKZKiX4pkZaVx+8nn2mhW8emm773Z3dv/u3fHFk +7D...
The above is part of a .png file. Are there any modules that work with this kind of conversion? Been searching the internet for "Text to Image" variations and that seems to be the wrong terminology. So a point in the right direction would be extremely appreciated. Also I could specify to receive an .jpg or I believe a .gif also.

Thank you very much in advance.

Replies are listed 'Best First'.
Re: Converting Text Images into Images
by almut (Canon) on Jun 05, 2008 at 17:53 UTC

    Could be base64 encoding, in which case you could try MIME::Base64 to decode the string.

Re: Converting Text Images into Images
by Phoenix Rising (Initiate) on Jun 05, 2008 at 18:56 UTC
    You are looking for MIME::Base64's decode_base64 routine. Pass the entire image string in, and you should get the image back in a scalar variable.
Re: Converting Text Images into Images
by mhearse (Chaplain) on Jun 05, 2008 at 19:21 UTC
    There is also a nice *nix command called uudecode, which is part of sharutils. It can decode base64.
Re: Converting Text Images into Images
by Anonymous Monk on Jun 06, 2008 at 05:02 UTC
    The above is part of a .png file. Are there any modules that work with this kind of conversion?

    The name of the format, xml specification ... is not a secret, so its useful to include that information.

      I guess I don't know what your asking here. What the XML specification is?