

Show HN: An open source website preview generator tool using webkit (live demo) - rcruzeiro
http://previewtool.raphaelcruzeiro.com/

======
pdx
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.

------
joshfraser
I do this with <http://phantomjs.org>

------
icoloma
Any insights about how it is different from webkit2png?

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

~~~
rcruzeiro
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).

------
mlitwiniuk
And how this is different from wkhtmltoimage?
<http://code.google.com/p/wkhtmltopdf/>

~~~
rcruzeiro
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.

~~~
jrockway
How is wkhtmltopdf not a "command-line tool"? Both your tool and wkhtmltopdf
require a (virtual) framebuffer, so neither are lightweight.

~~~
rcruzeiro
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.

~~~
jrockway
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" :)

~~~
rcruzeiro
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.

------
bearwithclaws
An unrelated nitpick: make your paragraph line-height at least 25px.

~~~
rcruzeiro
Thanks for the advice, the line height is now 25px.

