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?
perlmonks.org content © perlmonks.org and shimmin, Zaxo
prlmnks.org © 2006 edmund von der burg (eccles & toad)
v 0.03