Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Store image in string

by kejohm (Hermit)
on Mar 14, 2011 at 02:21 UTC ( #893018=note: print w/replies, xml ) Need Help??

in reply to Store image in string

You could store the image data encoded as something like Base64, and then decode it when you print it to file, like this:

#!perl use strict; use warnings; use MIME::Base64; my $data = < base64-encoded data here >; open my $outfile, '>', 'file.gif' or die $!; binmode $outfile; print {$outfile} decode_base64($data); close $outfile;

See the MIME::Base64 manpage for information about Base64 encoding, as well as examples of encoding files.

Update: Oops, sorry Grandfather, you were too quick for me.

Another Update: Link fixed.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://893018]
and the questions are moot...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2017-06-26 19:41 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (589 votes). Check out past polls.