Re: Resizing xpm data?

On 2/20/07, Daniel Kasak <dkasak nusconsulting com au> wrote:
Firstly, I don't do a lot of work with images, so this mightn't be the
best way to do it:)
Gtk2::Gdk::Pixbuf has image scaling support, eg:

$pixbuf = $pixbuf->scale_simple(

I don't know if you can make a Gtk2::Gdk::Pixbuf directly from an xpm -
never tried, probably works, but I'm sure there's a way. Once you've got
your scaled image, you can go:

$img = Gtk2::Image->new_from_pixbuf ( $pixbuf );


$img = Gtk2::Image->new;
$img->set_from_pixbuf($img->get_pixbuf->scale_simple(16, 16, "hyper"));

Does exactly what I need :) Thanks for the help there. I think my main
problem is trying to resolve all the 'bits' of an image
(image/pixbuf/etc) that I need to know.


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