[SLUG] Screen Capture

Paul Teasdale pdt at rcsuk.fsnet.co.uk
Sun Feb 6 16:03:02 GMT 2005


On Sunday 06 February 2005 09:20, Paul Teasdale wrote:
> Does anyone know of a good utility that allows you to do rapid screen
> capture.
>
I have now solved this with the following method:

Using the xwd (x window dump) you can capture the screen and create an xwd 
file. So:

xwd -out image1.xwd -root

This command will capture the whole screen into image1.xwd. These xwd files 
are readable by GIMP just out of interest but it is a format I have never 
personally come across before.

Next I wrote a small script to generate a unique file name. So:

#
#!/bin/bash
#
COUNT=0

for file in image*.xwd
do
  let "COUNT = COUNT + 1"
done

let "COUNT = COUNT + 1"

#id was obtained by using xwininfo and was the id of the 
#window that I wanted to capture
#
xwd -out image$COUNT.xwd -id 0x26043c3

# script end

This script counts of all the image files (image*.xwd) in your current 
directory and then adds one to the count to give you a new file name. It then 
calls xwd and uses the new count in the file name. I also passed the id of 
just the window I wanted to capture using the id switch rather than capture 
the whole screen. If you don't pass the id or -root to xwd it will display a 
mouse crosshair icon and expects you to select the window you want to 
capture.

I then linked this script to a KDE menu item with a hot key of Shift+A

All that was left now was to browse the router web pages and hit Shift+A 
everytime I wanted to capture the browser window. This meant I could browse 
really quickly and capture really quickly - no dialog swapping - no waiting. 
Fortunately all the pages except one displayed in the browser without having 
to scroll.

Finally xwd files are rather big so I wrote a little script to convert them 
all to jpegs. So:

#
#!/bin/bash
#
for img in `ls *.xwd`
do
  convert $img jpg:$img.jpg
done

# script end

This scripts loops round all the files in the current directory ending 
with .xwd and uses the convert command on each one it fines to create a jpeg 
file called 'image_filename.xwd.jpg'.

All very crude to be honest but it it did that job perfectly. Hope this helps 
someone sometime.

I would still like to know if someone has discovered a better utility that 
provides the above functionality.

Regards,

Paul.





More information about the Scarborough mailing list