Linux Command Line
October 15, 2004 6:10 AM   Subscribe

I'm looking for a command line program for linux, that will take screenshots / screengrabs of webpages automatically ...

ie, I'd like to be able to run a command such as:
# /bin/grabbit --url=http://www.metafilter.com

I know there is a program that does this, I've seen it in the past, but I cannot find it now.
posted by ajbattrick to Computers & Internet (12 answers total)
 
I've never heard of such a program but it shouldn't be too hard to do: Run firefox or opera under Xvfb passing the browser the URL on the commandline. Send Ctrl-P and Enter using XSendEvent or the XTEST extension (make sure the browser is set up to print to file). Lather, Rinse, Repeat.

It does waste a fair bit of memory and CPU ofcourse, but I doubt you'll want to do do hundreds of these?
posted by fvw at 6:34 AM on October 15, 2004


Whoa. Cool. How could you automate the process so the screenshots were mailed to a given address? And would this all work on OSX as well?
posted by yerfatma at 6:42 AM on October 15, 2004


The way that I had seen it was using X. And actually, I was looking to do about 8000. Nightly too, though I realise that will prolly be too much for my server.

yerfatma: Yes
posted by ajbattrick at 6:47 AM on October 15, 2004


wget and curl will grab the object referenced by a URL. I'm sure you could easily convince one of these tools to grab an entire page, that is, all the objects contained within. Converting the whole page to an image ('screenshot') would be another matter. So this may not be so helpful.
posted by sohcahtoa at 7:16 AM on October 15, 2004


Yerfatma: mailing the screenshots would be trivial in a shell script. As for working under OSX, not quite. Well, you could just install the dummy X server (OSX has one of those, right?) and do what I said, but every platform has their "Send fake keypress to window" calls and printing to a postscript file shouldn't be hard to set up on any OS so the general idea works anywhere.


The more important question is "Why would you want to do this?" though. I really don't see how rendering when viewing could be a drawback.
posted by fvw at 8:19 AM on October 15, 2004


Yerfatma, for OS X checkout this python script that'll do the same thing without as many gymnastics.
posted by alan at 8:29 AM on October 15, 2004


"Why would you want to do this?"

Insane levels of laziness: I'm envisioning a future, the children of whom (by which I mean me) don't have to get up from their desk to check sites on the stupid Mac while they're developing. And if I can do the same for Konqueror, so much the better. Saves two trips.
posted by yerfatma at 9:28 AM on October 15, 2004


Took me a while to find it, but there was and old AskMe Thread that started out on general screen capture, but ended discussing a few tools like url2png and url2bmp. I couldn't find those two tools, but khtml2png looks promising...
posted by weston at 3:27 PM on October 15, 2004


iCapture sort of does the trick, albeit in website rather than command line utility form. Still kinda useful to see what your web designs look like on Safari, though.
posted by arto at 11:38 PM on October 15, 2004


yerfatma: considered VNC?
posted by cheaily at 12:42 AM on October 16, 2004


Yeah, I installed a server on one of the boxes I "own" at work, but I haven't gotten around to playing with it. The machine's dog slow as it is, so I was figuring VNC would be painful. Is that accurate?

Plus it's so close to VC and I've had bad experiences with Charlie in the past.
posted by yerfatma at 5:58 AM on October 16, 2004


What alan said: webkit2png works great for OS X.
posted by weston at 5:51 PM on October 16, 2004


« Older Compression issues using iMovie.   |   how do you overcome shyness? Newer »
This thread is closed to new comments.