by Viktor Horvath, in November 2006 (article #393)
Being between a "tip" and an article in length, this will show you how to produce gigantic screenshots using a VNC virtual desktop. No big magic involved, so it's rather a hint for those who don't know yet the possibilities of VNC.
Table of Contents
It's a commonplace that an image (or screenshot) says more than thousand words. But imagine that the screenshot you want to make spans multiple pages on your screen. A large graph for example that cannot be exported to a PostScript or PDF.
In my particular case, I wanted to show how I corrected a text, so I wanted the other person to see the changes I've made. Now, that's the classical case for a diff, but what if the partner doesn't know how to read it, or even more, if he got a system without sophisticated graphical diff tools like TkDiff or KDiff3  ? So, I'd prefer to send a screenshot of my nice KDiff3 view – but the window has more than five screen pages, you have to scroll down vertically. Making five screenshots and assembling them in the GIMP would be one possibility. Creating a huge virtual screen and making one screenshot of that huge screen is another, which I'll proceed to describe here.
What is VNC?
I don't want to repeat the good introductions to Virtual Network Computing that exist on the web . In short, a desktop (screen output, mouse and keyboard input) is shared over the network - the computer whose desktop you want to share runs the VNC server, and the computer where you want to see and control the other's desktop inside a window runs the VNC client. Originally developed by the University of Cambridge, UK and AT&T, the VNC headquarter is now at the UK company RealVNC . Fortunately, there are not only free software implementations of the VNC protocol, but it's also cross-platform, so you can control a Mac OS X desktop from a GNU/Linux box and vice versa. And there are many tools and ideas around VNC.
On Microsoft Windows and Mac OS X, you only have one single desktop, so you share your current one; on Unix and GNU/Linux you usually create another desktop (though there are programs to share your current one ), the same way as you can have multiple X servers on the same machine. In fact, the new VNC desktop is a X desktop "envelopped" by VNC. If your machines are firewalled or if you want to secure your communications, you can tunnel the VNC connection through SSH (provided that the machine you are connecting to hosts a SSH server) .
VNC vs. X11
As you probably know, you can also transfer single X11 windows across the net, having the application run on machine A and see the windows on machine B. The main differences of VNC are:
Installation, configuration and start of the VNC server
Each major distribution provides packages for VNC server and client. If you're lucky, you already have commands like
apt-get install vncserver xvncviewer
I'm doing this on a Debian machine, but there shouldn't be major differences between distributions.
Normally, you'd just say:
vncserver :1 -localhost
and you have a new X server running on display :1, accessible by connecting to the VNC server who listens on port 5900 + display number, so in this case on port 5901. Because of the
You can connect to this server with the client:
If you have secured your VNC connection with a password (using
However, probably due to my individual startup scripts in
vncserver -kill :1
and to create a file
$vncStartup = "~/.vnc/xstartup";
Now, we actually want to do our huge screenshot, so start the VNC server as big as you need. I find it nice to have the width slightly smaller than your actual screen width, in order to have only one direction to scroll. But maybe you need a larger width for your application.
vncserver :1 -localhost -depth 16 -geometry 950x5000
Connect to it as before (
Capturing the VNC screen
The rest is quite easy: Start your application whose window you want to capture, and make it look the way you want. For capturing the screen, I'm always lazy and use the well-known GIMP image editor. This time, of course, you have to start it inside the VNC desktop, just as your application. Then you can do "File -> Acquire -> Screen Shot..." as normal. You'll probably want just to save the output and do later editing in your normal desktop, to avoid scrolling. Sometimes you have to scroll quite a bit until you find the window that just opened!
Don't think that you need lots of video memory in order to do this. My machine is five years old, and the graphics card is even ten years old (4 MB RAM). You just have to wait a little bit, that's all.
All checked on 15th November 2006.
 Jason's Web Thingy: Securing a VNC connection with OpenSSH
About the author
I'm in the last year of informatics (and a bit of neurobiology) at the University of Hamburg, Germany. In my free time, I like rowing, recording and listening to audiobooks, free software and open content and the philosophy behind it.