in reply to Re^3: Which tk to use and how to show images?
in thread Which tk to use and how to show images?

For it to work, I had to make sure the data is base64 encoded ...

Now you mention it, I think I had to go that route also. It was a while ago.

That said, logic suggests that you should be able to bypass IO::String, and pass the output from gd directly to encode_base64():

my $png = $mw->Photo(-data => encode_base64( $gd->png ));

I see no reason that shouldn't work as what ends up in the file is exactly what comes out of the image methods, hence the need for binmode;

I've made quite a lot of use of GD (though I hardly qualify as an expert), but I am light on Tk;

(Grrr. I hate being unable to try stuff, and I hate the available upgrade paths for perl.)


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^5: Which tk to use and how to show images?
by rcseege (Pilgrim) on Nov 04, 2005 at 04:56 UTC
    I see no reason that shouldn't work as what ends up in the file is exactly what comes out of the image methods, hence the need for binmode;

    You're absolutely right -- it worked fine. Thanks for that! I've corrected the example to remove it.