I recently contributed some introduction to the Gerrit Project. This included some screenshots and understandably the project maintainers are concerned about the overhead of keeping these screenshots up to date. So just for my own interest I've started looking in to how to automate the generation of these screenshots. This is not a working solution yet, just a collection of the ideas I'm playing with.
This first thing I started looking at was how I could automatically create a screenshots of the browser. After a bit of googling these seem to be two broad techniques. There are a few tools that given a URL will generate an image. Khtml2png and webkit2png seem to be good examples of these tools. While these are fine tools I really want to be able to capture pictures of the application as I modify it, so they don't quite serve my purpose.
The second technique seems rather more promising, starting a headless X Server using xvfb, starting firefox in it and then creating an image of this virtual screen using the ImageMagick's import tool. This is really much simpler than it sounds, it looks something like this:
$ Xvfb :2 -screen 0 800x600x24 & -- Start the virtual frame buffer
$ DISPLAY=:2 icewm & -- Start ice window manager so we get chrome
$ DISPLAY=:2 firefox &
$ DISPLAY=:2 import -window root snapshot.png
Simple enough really, I think it's quite a neat trick myself. Of course it could be any X server, I'm using Xvfb to make it completely standalone, but it also works with Xephyr or Xvnc if you want to interact with the applications you've started. Jordan Sissel has even written ephemeral-x, a script which finds a free display number and starts Xvfb for this.
Next, attempts to automate the browser session so I can actually take the screenshots I need.
Comments !