Jump to content

Taking X11 Screenshots (on any distro)

Every so often I mess with [old Linux distros](https://zerker.ca/photos/#15597798463055) or BSDs and do not always have one of the modern screenshot tools available.

Enter xwd. This tool will dump an X11 window (or the root window) to a file for later viewing.

To dump a specific window (click the window after running):

$ xwd -out dump.xwd

To dump the screen (i.e. root window):

$ xwd -root -out dump.xwd

The XWD format is understood by a number of tools, including ImageMagick and GIMP among others. If imagemagick is installed, the following script could be bound to a key for quick and easy screenshots, where the destination path is provided to the script:

#!/bin/sh
datename=`date +%Y%m%d-%H%M%S`
outpath=/var/tmp/$datename.xwd
pngpath=$1/$datename.png
xwd -root -out $outpath
convert $outpath $pngpath
rm $outpath

Comments

There are no comments yet.

Add a Comment
Comment Atom Feed