Running applications in really high resolutions

We used a proprietary photobook application to create a wedding newspaper and ordered 2 copies of it. As the company wants to make too much money, they do not allow exporting the magazine as .pdf - but that's what I needed since I would not pay 30€ per copy - 15 times.

I could of course take apart an ordered copy and scan the single pages, but that would mean quality loss and it's very time consuming. So the only option left was taking screenshots. I wanted 300 dpi, which meant for a sheet size of A4 and two pages displayed per screen a required screen resolution of 6000x4000 pixels.

Unfortunately, no (windows) driver lets you set the resolution larger than the physical screen size, and all tries to convince VirtualBox to use such a large resolution failed.

The idea for the final solution came a bit later: Use a virtual X server with such a high resolution, run VirtualBox in it and maximize it. Voila - high-res screenshots. To access the virtual X server, I used VNC. Most VNC viewers have scrollbars, so moving the mouse across that large screen was no problem.

The single steps

First, we use Xvfb to create a virtual X screen:

$ xinit -- /usr/bin/Xvfb :1 -cc 4 -screen 0 6000x4000x16

Now, in a second terminal, we let x11vnc supply a VNC interface for our huge screen:

$ x11vnc -display :1

When that's done, we connect to the screen:

$ xtightvncviewer localhost:0

Now when you're ready to take screenshots, just use ImageMagick's import tool to create full copies of the screen:

DISPLAY=:1 import -window root screenshot-08.jpg

That's it.

Easier screen shooting

A little bash scripting, and you just have to press return to take a screenshot:

$ i=0; while true; do i=`expr 1 + $i`;\
echo press enter for screenshot $i; read;\
DISPLAY=:1 import -window root screenshot-$i.jpg; done

Creating a PDF

After I had all screenshots, they were cut with ImageMagick's convert command:

$ for i in screenshot-*.jpg \
    do convert $i +repage -crop 2431x3407+621+365 cut-$i-1.jpg \
done

convert is also the tool to use to create the PDF file. While the resulting PDF is a bit broken, it could be printed fine with Evince when using "shrink to printable area" in the printer's "page handling" configuration tab.

$ convert cut-*.jpg -page A4 final.pdf

Written by Christian Weiske.

Comments? Please send an e-mail. Or Reply or Like.