Busy making things: tinycast, github, links, photos, @mc.

khtml2png: Create Thumbnails of Webpages Under Linux

Posted: October 27th, 2003 | Author: | Filed under: Open Source | Comments Off

khtml2png is an excellent little program for Linux that allows you to create a thumbnail image from a specified website.  The program itself is pretty lightweight, but requires X, Qt, and kdelibs.  It needs both the libraries and the headers, which required me to install qt3-dev, kdebase-dev, and their various dependencies under SuSE 9.

It’s quite easy to use once you do the ./configure && make && make install dance.  Here is the command that produced the thumbnail on the right:

./khtml2png --width 800 --height 1000 --scaled-width 160 --scaled-height 200 http://postneo.com postneoss_tn.png

You could easily call out to khtml2png from inside your scripting environment, but it is probably not very well suited for a server environment.  In addition to requiring the desktop libraries, it needs to connect to an X server.  The workaround discussed in the README is to use Xvnc.  I think you’re best off running khtml2png on a desktop machine and then moving the thumbs to a server via your transport protocol of choice.

There is a similar program out there called html2jpg which uses Opera, Perl, and ImageMagick to do its work.

This is a fantastic hack with a GPL licence.  Rock on, Simon.

Comments are closed.