Taking a Screenshot in X11

From Leo's Notes
(Redirected from Screenshot)
Last edited on 14 June 2020, at 22:19.

Quick note on taking a screenshot on Linux.

Linux[edit | edit source]

This method has been used for the remote displays. Ensure xorg-xwd is installed, then run:

# DISPLAY=:0 xwd -silent -root > bob.xwd
# file bob.xwd
bob.xwd: XWD X Window Dump image data, "xwdump", 1824x984x24

The XWD file can then be converted by or opened with opened in GIMP. Alternatively, you can convert the file using the Python script at https://github.com/drj11/xwd2png (mirror at https://git.steamr.com/others/xwd2png)

## Example usage:
$ pip install --user pypng
$ export PYTHONPATH=$(python -c "import site, os; print(os.path.join(site.USER_BASE, 'lib', 'python', 'site-packages'))"):$PYTHONPATH
$ cat ~/bob2.xwd