shimmin has asked for the wisdom of the Perl Monks concerning the following question:
sub rerender {
`i_view32.exe .\\$imgfile /resample=($imgwidth,) /aspectratio /convert=".\\disp.png"`;
$display->configure(-file => 'disp.png');
}
This uses an external program (irfanview) to do the dirty work, saves the downsized image to a temp file, and then reads it into the Tk::Photo. Thinking it could be faster w/o writing and readign the temp file, I did this using the Image::Magick module:
sub rerender {
my $image = Image::Magick->new();
$image->Read($imgfile);
$image->Resize(width => $imgwidth, height => $imgwidth * 1.5, filter => Box);
my $blob = $image->ImageToBlob();
$display->configure(-format => 'png', -data => encode_base64($blob));
}
Which also works, but takes twice as long as the first version. Where do you think the time being spent? How could the image be produced and displayed any faster?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: displaying an image
by Zaxo (Archbishop) on Jul 01, 2004 at 15:21 UTC |