Re: Newbie question - replacing Gtk2::Image with another



Another question I have is how to resize the image before
displaying.

Create a GdkPixbuf, and use scale_simple(), eg:

my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file($file);

$pixbuf = $pixbuf->scale_simple($new_width, $new_height, 'bilinear');

$image->set_from_pixbuf($pixbuf);

That should do it.

G.

-- 
Gavin Brown
e: gavin brown uk com
w: http://jodrell.net/
PGP/GPG key ID: 891D8FCA




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]