How do I use command line and wmctrl to make a window larger than the screen to get a huge screenshot?

Posted by Mnebuerquo on Super User See other posts from Super User or by Mnebuerquo
Published on 2011-01-24T22:18:12Z Indexed on 2011/01/29 15:28 UTC
Read the original article Hit count: 217

Filed under:
|
|
|
|

I use a program which makes a large image which I have to scroll to view. The program has no way to save the image, and I have no access to the source to modify it. The only way I have to get the image from the program is by screenshot. My goal is to save the full size image without having to piece together individual screenshots.

I'm using this script to try taking a screenshot:

#!/bin/bash
window=$(wmctrl -l | grep "Program$" | awk '{print $1}')
wmctrl -v -i -r $window -e '0,0,0,6030,5828'
wmctrl -i -a $window
import -window $window ~/Desktop/screenshot.png

This uses wmctrl to get the window id ($window) for a window named "Program". It then tries to resize the window to the desired dimensions. It uses imagemagick (import) to save a screenshot.png on the user's Desktop. All of this works except the resize step.

I can resize the window using wmctrl -r -e, but sizes greater than the screen size don't work.

I'm using Ubuntu 10.04 and the Gnome Desktop. I run two monitors, but I've tried this with one of them disabled.

Is there a way to resize the window larger than my screen to get a huge screenshot?

© Super User or respective owner

Related posts about linux

Related posts about command-line