in reply to Win32 Tk JPEG from memory problem
I gotta say is thanks Jouke, no wonder you got that perl GUI book deal.#!/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;
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;"
|
|---|