Website Screenshot Thumbnail Creator Script

One day I needed to create thumbnails of about 300 websites, this
would usually take a very long time, so I wacked together a simple
shell script which makes use of Firefox, Xvfb, and Imagemagick

script creates a virtual X desktop, starts a Firefox instance, and
then, using the openUrl command, proceeds to load each website and
capture a screenshot one at a time.

If you cannot get Xvfb
working, you should be able to run this with little modification on a
spare linux desktop. I suggest you play with image magicks cropping
tools to remove the firefox decal.

here is the original bash script:

echo "Starting virtual screen......";
Xvfb :3 -screen 3 1024x768x24 &
sleep 5;
export DISPLAY=:3;
# needed fluxbox becuase mozilla width/height wouldnt work without a w/m
echo "starting fluxbox....";
fluxbox &
sleep 20;
# start the firefox process full screen on the virtual buffer
echo "starting firefox.....";
mozilla-firefox -width 1024 -height 678 &
sleep 15;
for i in `cat sites.list`; do
echo "processing $i .....";
if ( host $i 2>&1 > /dev/null ); then
echo " ... $i exists..";
mozilla-firefox -remote "openUrl(http://www.$i)"
echo " ... waiting for page to load";
sleep 10;
import -display :3 -w root ~/web/$i.jpg;
convert -geometry 200x200 ~/web/$i.jpg ~/web/thumb/$i.jpg;
echo "..... done";

Leave a Reply

Your email address will not be published.