|P is for Practical|
Resizing images && Tkby Jouke (Curate)
|on Mar 14, 2001 at 01:56 UTC||Need Help??|
Jouke has asked for the wisdom of the Perl Monks concerning the following question:
I've been asking a few questions regarding Tk lately, and once again, this has to do with Tk.
I have a lot of GIF images, and they all are displayed as buttons. To view them in a matrix of 4x4, they are all resized to a certain $MAX_HEIGHT and $MAX_WIDTH like this:
this snippet of code is executed within a loop (that's why the @images exists)...
The problem I have is that I actually want all images to have the exact same width. With this code (using $scaledimage->copy($images[$y], -subsample => $scalefactor) it's only possible to use integers as $scalefactor.
I know I can use PerlMagick to resize images, save them and reload them again, but that takes two more disk-actions, and the whole thing isn't that fast already.
Is is possible to scale an image in Tk with 'floats' ? Rescaling with integers makes images either large or small...
Jouke Visser, Perl 'Adept'