There’s no good solution for that which I know of, and in fact, it would probably require hacking up some well known renderer (Gecko or WebKit mainly).
The Mozembed only allow to display the web page
(so you need a X server, there are several programs automating this, but its slow and not very elegant).
Well, I came up with my own solution, it’s far from perfect, yet much better. Using QT4?s WebKit renderer and the fake x server (Xvfb - bundled with Xorg) you can have a command line tool
rendering pages perfectly!
Of course this can be converted to C++ easily or probably you can call the WebKit library
directly - maybe i’ll try that in the future. (Or then again, hack QT not to request a X server connection, if that’s
Run as (for example):
xvfb-run -a ./thumbpage.py 1024x768 http://www.insecure.ws/ insecure
If you need, you can uncomment the full page output (no scaling).
made a nicer version of this script with xvfb wrapped in and checking for loading timeout, etc.
While a better solution would still be to bypass QT and render ‘by hand’ to and image file, or hack QT to do so (without
requiring any X server connection, and using fewer dependency than large QT libraries…), I decided to run my script
again, and I ran into troubles with python-qt4 on some debian systems (and older Fedora system, as a reader pointed
Anyway, I remade the script into half-proper C++ so it uses fewer dependencies, execute faster, but most of all, always
links properly to QT even if the python-qt4 bindings are not working properly.
To compile, you need the QT4 dev package.
This project has also been forked here http://gitorious.org/wkthumb