ichimunki has asked for the wisdom of the Perl Monks concerning the following question:
sub show_next_image { my( $id, $filename ) = get_next_pic(); my $raw_image = $Image_Window->Photo( '-format' => 'jpeg', -file => $filename ); my ($img_w, $img_h) = ($raw_image->width, $raw_image->height); my $max_width = $Main->screenwidth()-20; my $max_height = $Main->screenheight()-75; my $xfactor = $img_w / $max_width; my $yfactor = $img_h / $max_height; my $intfactor = $xfactor > $yfactor ? int($xfactor) : int($yfactor +); $intfactor += 1; my $image = $Image_Window->Photo(); $image->copy( $raw_image, -subsample => $intfactor); my $reduced_flag = ( $raw_image->width == $image->width ) ? 'full-size' : "reduced by $intfactor"; $Image_Window->delete( '0.1', 'end' ); $Image_Window->insert( '0.1', "$reduced_flag\n" ); my $image_widget = $Image_Window->imageCreate( 'end', -image => $i +mage ); $raw_image->destroy(); $image->destroy(); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk Image Flipping - Out of Memory
by Yohimbe (Pilgrim) on Feb 08, 2001 at 09:10 UTC | |
|
Re: Tk Image Flipping - Out of Memory
by kschwab (Vicar) on Feb 08, 2001 at 09:19 UTC | |
by tye (Sage) on Feb 08, 2001 at 21:05 UTC |