in reply to How to handle Tk::Photo-data()?
#!/usr/bin/perl -w use strict; use GD; use Tk; use Tk::JPEG; use MIME::Base64; # Create the main window my $main = MainWindow->new(); # Open a JPG image in GD my $im = GD::Image->new('feather.jpg'); # Create an empty image with the desired dimensions my $resizedim = new GD::Image(120,120); # Copy everything from $im and resize it into $resizedim $resizedim->copyResized($im,0,0,0,0,120,120,$im->getBounds()); # encode the jpeg-output of the $resizedim my $img = encode_base64($resizedim->jpeg()); # create a Photo object with the data and display it within a label my $image = $main->Photo("button", -data => $img, -format => 'jpeg'); my $label= $main->Label(-image => "button"); $label->grid(-in => $main); MainLoop;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: How to handle Tk::Photo-data()?
by stormwolfen (Acolyte) on Dec 15, 2001 at 04:22 UTC | |
by Jouke (Curate) on Dec 15, 2001 at 18:37 UTC | |
by stormwolfen (Acolyte) on Dec 17, 2001 at 00:03 UTC |