in reply to Win32 Tk JPEG from memory problem

Not too long ago I ran into the same problem, and the only place I found a solution was pVoice and pStory. It's probably documented somewhere, but I couldn't find it at the moment (in my perl Tk documentation; it's prolly documented in the c or whatever other lang Tk is available originally in). It turns out, that when you specify a -data string, it has to be base64 encoded, and that is why the following works;
#!/usr/bin/perl -w $^W=1; use strict; use Tk; use Tk::JPEG; use MIME::Base64 qw( encode_base64 ); my $fname = "rock.jpg"; open(F, $fname) or die "cant open $fname"; binmode(F); undef $/; my $jpeg = <F>; close(F); my $win = new MainWindow; my $image = $win->Photo( -data => encode_base64($jpeg), -format => 'JPEG', ,); $win->Label(-image=>$image)->pack; MainLoop;
I gotta say is thanks Jouke, no wonder you got that perl GUI book deal.

update: after some "testing" :D, it turns out you don't really need to specify -format, as it will pick it up from the -data.

 
___crazyinsomniac_______________________________________
Disclaimer: Don't blame. It came from inside the void

perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"