mellin has asked for the wisdom of the Perl Monks concerning the following question:

I'm curious if anyone has implemented a way to create an image preview/thumbnail of a website? Say you wanted to maintain a catalog of different websites using image previews, how would one proceed? Is there a module answering the question already out there? I have a project in mind that I'd like to start but I cannot seem to get around this. I guess you need to have a rendering engine of some sort that supports CSS and so on, which then also provides you the image creation.

Replies are listed 'Best First'.
Re: Website image preview
by moritz (Cardinal) on Oct 05, 2009 at 06:55 UTC
    I don't know about Perl modules, but for example here is small C++ program that creates such images, using the webkit renderer.

    All you need then is a bit of perl code to call, presumably via system.

    Perl 6 - links to (nearly) everything that is Perl 6.

      Thank you for mentioning that CutyCapt. I've been testing it now with couple of websites and it seems to work just fine. It just seems to take quite a long time to finish the process for some websites, e.g. CNN.com taking as long as 25 seconds to finish. But I'm happy with it otherwise. Thank you very much.

Re: Website image preview
by Corion (Patriarch) on Oct 05, 2009 at 07:23 UTC

    Unless you manage to build a headless Mozilla Firefox or headless Webkit, which you can then maybe use to render the websites into image files, there are Win32::CaptureIE and Imager::Screenshot, which can take screenshots of running programs, for example, web browsers displaying the site in question.

      Unless you manage to build a headless Mozilla Firefox or headless Webkit
      Or as a work around, use Xvfb and xvfb-run to run any of them inside a virtual frame buffer.