Re: Grab a pixmap / screenshot thing



Torsten Schoenfeld wrote:
On Tue, 2006-11-07 at 10:08 +1100, Daniel Kasak wrote:
Is it possible to create a pixmap of the current desktop ... or part of it ... using gtk2-perl?

Get the Gtk2::Gdk::Window for the root window.  Create a pixbuf from it.
Save the pixbuf to disk.

  use Gtk2 -init;
  my $s = Gtk2::Gdk::Screen->get_default;
  my $w = $s->get_root_window;
  my $p = Gtk2::Gdk::Pixbuf->get_from_drawable (
            $w, undef, 0, 0, 0, 0, $s->get_width, $s->get_height);
  $p->save ("screenshot.png", "png");'

I don't know if that works on anything but X11, though.

Excellent. Now things are looking fancy :) It seems to work perfectly on Windows too. Thanks Torsten. And sorry about the delayed reply ... it's very busy at the moment.

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak nusconsulting com au
website: http://www.nusconsulting.com.au



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