|
This document is available in: English Français Indonesia Italiano |
by Viktor Horvath <viktor /at/ ibiblio.org> 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. Content: |
Huge screenshots using VNCAbstract:
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.
|
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 [1] ? 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.
I don't want to repeat the good introductions to Virtual Network Computing that exist on the web [2]. 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 [3]. 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 [4]), 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) [5].
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:
Each major distribution provides packages for VNC server and client. If you're lucky, you already have commands like vncserver or xvncviewer. On Debian and friends, you can get it as usual, being the superuser:
apt-get install vncserver xvncviewerI'm doing this on a Debian machine, but there shouldn't be major differences between distributions.
Normally, you'd just say:
vncserver :1 -localhostand 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 -localhost parameter, you can only connect locally or by using SSH.
You can connect to this server with the client:
xvncviewer :1If you have secured your VNC connection with a password (using vncpasswd), you have to enter it now. Then, your desktop should appear in a window.
However, probably due to my individual startup scripts in ~/.xsession, the window manager did not show up in the client (or worse, he would continuously create new error windows). So I had to exit the vncserver:
vncserver -kill :1and to create a file ~/.vnc/xstartup with just a minimal configuration (exec icewm as the only line). That's the configuration for the X server started by VNC, not the VNC configuration itself! That one is located in /etc/vnc.conf and ~/.vncrc. I had to write one line in the latter in order to actually use the xstartup I just created, so my ~/.vncrc looks like:
$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 950x5000Connect to it as before (xvncviewer :1).
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.
This is just an example, I'm comparing two versions of the same section in the German Debian-installer manual in KDiff3. Click on it to view the original resolution.
All checked on 15th November 2006.
[1] Two of many graphical diff utilities:
TkDiff: http://tkdiff.sourceforge.net
KDiff3: http://kdiff3.sourceforge.net
[2] VNC in Wikipedia:
http://en.wikipedia.org/wiki/VNC
Some background information, by Tim Waugh for the Red Hat Magazine:
http://cyberelk.net/tim/articles/VNC/index.html
[3] RealVNC homepage:
http://www.realvnc.com
[4] x11vnc (one long page):
http://www.karlrunge.com/x11vnc/
Also, RealVNC version 4 and above claims to be able to share the current
X11 session.
[5] Jason's Web Thingy: Securing a VNC connection with
OpenSSH
http://www.trekweb.com/~jasonb/articles/vnc_ssh.shtml
From the old AT&T/Cambridge VNC pages: Making VNC more secure using SSH
http://www.cl.cam.ac.uk/research/dtg/attarchive/vnc/sshvnc.html
Webpages maintained by the LinuxFocus Editor team
© Viktor Horvath "some rights reserved" see linuxfocus.org/license/ http://www.LinuxFocus.org |
Translation information:
|
2007-03-26, generated by lfparser version 2.54b