in reply to view online jpeg in Tk ?

This will do it, without creating any temp image file. You need to get the binary image with LWP, Base64encode it to please Tk, then use the -data option.
#!/usr/bin/perl -w use strict; use Tk; use Tk::JPEG; use LWP::Simple; use MIME::Base64; my $URL = 'http://zentara.net/2uni2.jpg'; my $content = encode_base64(get($URL)) or die $!; my $mw = MainWindow->new(); my $image = $mw->Photo(-data => $content); $mw->Label(-image => $image)->pack(-expand => 1, -fill => 'both'); $mw->Button(-text => 'Quit', -command => [destroy => $mw])->pack; MainLoop; ############################################# #1 liner # perl -MLWP::Simple -MMIME::Base64 -MTk -MTk::JPEG -e '$mw=tkinit; # $mw->Label(-image => $mw->Photo(-data => encode_base64(get(shift))) +)->pack;MainLoop' # http://...

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re^2: view online jpeg in Tk ?
by Anonymous Monk on Sep 11, 2006 at 19:58 UTC
    pretty clever..Thanks alot, thats perfect!