Search code examples
pythonlinuxscreenshot

Simple way to capture a webpage screenshot using python


Possible Duplicate:
How to get a website screenshot in python

"Simple way to capture a webpage screenshot using python!"

I have google'd a little for the subject, but can't find anything useful ...

I need a way to capture screenshots of websites with a Python script from a Debian "server" Linux (no X) .. how is that possible? Is there a simple way?


Solution

  • Try this http://www.blogs.uni-osnabrueck.de/rotapken/2008/12/03/create-screenshots-of-a-web-page-using-python-and-qtwebkit/

    Oh, wait! QWebPage depends an QtGui, and QtGui depends on a running X server (at least on Unix systems). So how can we make use of this on a headless server machine? The answer is Xvfb, a framebuffer based X server, originally designed for testing purposes. Of course, it requires some X-libs and fonts, too (how should a page be rendered without any fonts?), but it does not have so much overhead like the real XOrg-server and don’t need to be running all the time. Just call the script this way: