in reply to Re: Re: using an image in binary perl
in thread using an image in binary perl TK

You could use Perl's built in UU-encoding, built into pack/unpack, using the "u*" template, to convert any binary string to a text string of limited line length.

You can use the following code to load the file and generate the Perl code to set the image string, which you can then include in your script:

{ open IN, "tsl_logo1.gif"; binmode IN; local $/; print "\$image = unpack 'u*', <<'_END_';\n"; print pack "u*", <IN>; print "_END_\n"; }

Of course, that requires that you can just set an image in a UI from a binary string, instead of loading it from a file. I don't know what module you're using for the UI, so you'll have to check that yourself.