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
Have a second? Check out this great Canadian Health & Living Store based in Toronto


January 28th, 2008 at 3:05 pm
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?
February 11th, 2008 at 6:27 am
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
February 11th, 2008 at 12:09 pm
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
February 14th, 2008 at 6:47 am
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.
December 19th, 2011 at 2:53 pm
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..