views:

250

answers:

2

Hey there,

I asked this question about taking a picture of a webpage programmatically, and I've downloaded and got webkit2png working (taking pictures of HTML pages like blogs and whatnot). So cool, thanks for showing me that!

Now I would like to start doing more, like being able to take pictures of Flash websites after they have loaded, and of my desktop.

Is it possible to take pictures of Flash websites with webkit2png (considering you might have to wait a few seconds for it to load)?

But the main question is, how do I programmatically take pictures of the desktop? That would allow me to have much more control over what's going on.

A: 

You can use xwd(1) to take a screenshot of the root window:

xwd -display :0 -root|xwdtopnm |pnmtopng > $1
codehead
+1  A: 

This is an awesome question!

A couple of years ago I has to work on a similar project. I found a library, called watir, you can use to control system browsers from Ruby. At the time I checked, it wasn't really reliable in a Linux environment, but right now it seems to be pretty solid.

Here's a couple of links:

I have never tried this solution so I would be really happy if you can write here a feedback if you decide to go with Watir. All the examples targets a Windows server, I didn't found a valid tutorial using a Linux + Firefox environment.

Simone Carletti
Thanks man, I actually use Mechanize on a Mac.
viatropos