Ubuntu Linux: Generate Thumbnail Image of External URL

This was surprisingly a lot harder to figure out than I initially expected. I was doing a lot of searching and kept finding either solutions for windows or packages that cost money. To add to the problem, I needed a solution that ran in a command line only version of Linux (Ubuntu Server). I guess I was naive to think the PHP gd library would support this. After a lot of digging last night, I found webthumb. Getting it work was surprisingly easy using the instructions provided, just replace mozilla for firefox and add the xwd package:

Code:
apt-get install xvfb
apt-get install firefox
apt-get install netpbm
apt-get install xwd

wget http://www.boutell.com/webthumb/webthumb.tar.gz
tar xvzf webthumb.tar.gz
cd webth*
./webthumb http://www.sematopia.com/ | pnmscale -xysize 100 100 | pnmtojpeg > thumb.jpg

Enjoy

Related Articles:

Have a second? Check out this great Canadian Health & Living Store based in Toronto

5 Responsesto “Ubuntu Linux: Generate Thumbnail Image of External URL”

  1. alper says:

    You must be really lucky that it worked at first time. When I try to run webthumb, I get errors due to xvfb not being able to start because of “error opening security policy file /etc/X11/xserver/SecurityPolicy”. Do I need to install an additional package for xvfb to run properly? Do I need Xorg to be installed?

  2. Marcus Herou says:

    Are you really sure it will work with firefox?
    The -remote command for instance is not available in firefox… The perlscript as well calls the mozilla binary not the firefox one. I got it to work with various results after I installed the “old” mozilla-browser package for edgy.

    Any further ideas ? Seems like a smart way of doing it with xvfb.

    Kindly

    //Marcus

  3. George A. Papayiannis says:

    Hey guys,

    Yeah – I was lucky to get this to work initially. It did work with Firefox also. After I wrote this post I starting getting a bunch of strange errors, I managed to get it working again, but it was still a headache. Unfortunately, I can’t remember the errors or what else I did to make it work, as I haven’t touched it since.

    All the best,
    George

  4. Marcus Herou says:

    I can recommend this article: http://oltsm.blogspot.com/2007/07/ruby-website-screencapture-howto.html
    It took me something like half a day to get it working fully and (almost) seamless. Now it has been rolling as a cronjob for a couple of days with no errors.
    All thumbnails at tailsweep.com is generated with this one.

  5. Vmware Workstation 8, Vmware, Virtual Workstation, Virtual ware, Virtual machine, Virtual,Linux, windows, says:

    I’m extremely impressed together with your writing talents as neatly as with the format for your weblog. Is this a paid theme or did you customize it yourself? Anyway stay up the nice high quality writing, it is rare to see a nice blog like this one nowadays..

Leave a Reply

Line and paragraph breaks automatic.
XHTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>