website screenshot server on debian stable

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.

 

 


Posted by mvanbaak (80.126.xx.xx) on Mon 10 Jul 2006 at 17:44
[ Send Message ]
You have an error in the article.
xbase-fonts should be xfonts-base :)

Thanks for the great article, I'm running apt-get on my server now :)

[ Parent | Reply to this comment ]

Posted by olivM (87.240.xx.xx) on Mon 10 Jul 2006 at 17:49
[ Send Message ]
thanks for the errata
it's fixed

[ Parent | Reply to this comment ]

Posted by dkg (216.254.xx.xx) on Wed 12 Jul 2006 at 00:54
[ Send Message | View dkg's Scratchpad | View Weblogs ]
Don't you need to install imagemagick in order to be able to run /usr/bin/import? Or is that pulled in as a dependency of one of the other packages? If not, perhaps it should be added to the initial apt-get install invocation?

Thanks for the writeup!

[ Parent | Reply to this comment ]

Posted by BeJot (217.11.xx.xx) on Thu 13 Jul 2006 at 13:07
[ Send Message ]
Hi.

Works also with xvfb (Virtual Framebuffer 'fake' X server).

Xvfb :1 -screen 0 1024x768x24 &

[ Parent | Reply to this comment ]

Posted by Anonymous (84.152.xx.xx) on Fri 10 Nov 2006 at 15:01
Hi can someone explain how this works, I don't hav an Xserver installed.
THX Josh

[ Parent | Reply to this comment ]

Posted by Anonymous (70.79.xx.xx) on Wed 20 Jun 2007 at 16:09
There's a good KHTML based command-line tool for doing just what you're talking about called khtml2png. I have a quick writeup about using it with vncserver on a monitor-less server. I also talk about patching the source to allow thumbnail image generation.

http://blogs.nitobi.com/jake/index.php/2007/05/09/website-screens hots-on-linux/

[ Parent | Reply to this comment ]

Posted by Anonymous (91.19.xx.xx) on Sun 26 Aug 2007 at 19:05
Wow, thank you very much!! it works!

[ Parent | Reply to this comment ]

Posted by Anonymous (195.14.xx.xx) on Tue 23 Dec 2008 at 09:58

[ Parent | Reply to this comment ]

Posted by Anonymous (41.204.xx.xx) on Tue 23 Dec 2008 at 10:17
Add


user_pref("browser.sessionstore.enabled", false);


to your /perso_dir/.mozilla/firefox/idffjglkg.default/prefs.js

idffjglkg.default and perso_dir are not the same for you ;)

[ Parent | Reply to this comment ]

Posted by Gilgongo (78.86.xx.xx) on Fri 16 Oct 2009 at 22:44
[ Send Message ]
The trouble with using "import -window" in the last step is that it only grabs the current viewport. If you want to screenshot a page that's longer than the browser's window, then it will be truncated.

Instead, you might want to consider using a Firefox/Iceweasel add-on called Peal Crescent Page Saver. You can then give Firefox an argument to capture the entire page, regardless of size.

[ Parent | Reply to this comment ]

Posted by Anonymous (94.223.xx.xx) on Tue 25 May 2010 at 08:56
Idee wie man da Vollbild hinbekommt? Ohne den Browser-Kopf und alles drumherum?

[ Parent | Reply to this comment ]

Sign In

Username:

Password:

[Register|Advanced]

 

Flattr

 

Current Poll

Which init system are you using in Debian?






( 1062 votes ~ 6 comments )