13 comments

[ 165 ms ] story [ 938 ms ] thread
I have been getting help from Raphael, since I had no experience with graphics on headless servers.

To save others time, with his help, this got me working so I could start playing with this.

    git clone https://github.com/raphaelcruzeiro/webimage.git
    sudo aptitude install -y xvfb
    sudo aptitude install -y libqtwebkit-dev
    cd webimage
    qmake webimage.pro
    make all Makefile
    xvfb-run --server-args="-screen 0, 1024x768x24" ./webimage http://news.ycombinator.com/ output.jpg 1024
I'm now up and running, taking screen shots. Thanks Raphael.
Any insights about how it is different from webkit2png?

http://www.paulhammond.org/webkit2png/

webkit2png runs only on Mac it seems. Webimage can be compiled for all major platforms. Aside from this, the tools have the same purpose (I must confess that I didn't know webkit2png when I wrote Webimage).
And how this is different from wkhtmltoimage? http://code.google.com/p/wkhtmltopdf/
This seems to be a tool for converting a webpage to a PDF file which is n the purpose of my tool. Also my tool is a simple, lightweight command line tool. Also, analyzing wkhtmltoimage's source I can say that my tool's approach to rendering the web page is potentially better than wkhtmltoimage's as I use whatever GUI toolkit is available on the system instead of letting webkit render itself on a pixmap (Something that can cause lots of errors on fonts, anti-aliasing, etc).

I'm not saying that the way I handle the rendering is any better than wkhtmltoimage's so feel free to use both and choose which you find it's better.

How is wkhtmltopdf not a "command-line tool"? Both your tool and wkhtmltopdf require a (virtual) framebuffer, so neither are lightweight.
I said wkhtmltopdf's purpose is to generate a PDF, mine is to simply generate an image. And both are lightweight since they can run on a EC2 micro instance, generating multiple previews , without increasing the server load significantly. As for the need to a framebuffer, that's just the way it is when you want to render something. You could write an embedded framebuffer (and an embedded GUI kit for that matter) to the tool but that would make it a giant mess. To goal of the tool is to be simple and I believe that was achieved by writing a software with only 5 source files.
You seem kind of upset that someone went back in time and beat you to the punch by about five years.

Also, run "make world" for Xorg some time and let me know if you still consider Xvfb lightweight. There's a reason the target is called "world" :)

Not at all, the tool does everything it was designed to do (at least for my projects) and I had some really nice feedback. I didn't create this to compete with anything out there, I was basically scratching my own itch since I didn't find any readily available tool that produced the result I needed.

And I will again point to you that lightweight is relative, if you know a better way to fake an X Server without xvfb just let me know and I'll use it on my tool.

exactly what I thought
An unrelated nitpick: make your paragraph line-height at least 25px.
Thanks for the advice, the line height is now 25px.