Posted by olivM on Mon 10 Jul 2006 at 15:02
Despite being both great and free the online service thumbshots, which is used to create images of what a website looks like, can't be used for professional use. Here we'll demonstrate how to reproduce that service ourselves.
Here is how we'll create our own website screenshot service on a Debian stable server in less than 10 minutes.
First install vncserver, a simple desktop environment, a web browser and a tool to export images :
apt-get install vncserver xfonts-base xfce4 mozilla-firefox imagemagick
Start the vncserver service :
vncserver :1 -geometry 1024x768 -depth 24
Configure the desktop and browser to your own preferences. You'll probably wish to remove any unnecessary panels, session-managers, etc, and install some plugins for your browser:
killall x-session-manager ssh-agent xftaskbar4 xfdesktop xfce4-panel
Now you can open a session to your server's desktop environment to see how it's looking :
xvncviewer x.x.x.x:1 &
The next step is to create a simple script to take a screenshot of a given website. We'll call our script screenshot.sh, and give it the following contents:
#!/bin/bash export DISPLAY=":1" /usr/bin/firefox --display :1 "$1" > /dev/null 2> /dev/null & /bin/sleep 10 /usr/bin/import -window root -display :1 "$2" killall firefox-bin
The script can be called as follows:
./screenshot.sh http://www.debian-administration.org/ ~/debian_admin.jpg
That's it !
This article was inspired by Anton Titov's post on How to make site screenshots with linux server.