HOWTO: Linux Screenshots

Posted in tech; tagged with howto, linux

Here’s a simple workflow to create space efficient PNG screenshots from the Linux command line. You’ll need Image Magick installed and pngquant.

You’ll probably want the option of producing lossy PNG files so in addition to the ubiquitous Image Magick install:

sudo apt-get install pngquant

Example: Grabbing a full screen image (from another dwm workspace in my case), 5 second delay to make it possible to grab image with menu or other click or hover effect in action:

sleep 5; import -window root png:- \
| convert png:- -thumbnail 1500 png:- \
| pngquant - --quality 64 > screenshot.png

Example: Grabbing image of a single window - click on the window you wish to capture:

import png:- \
| convert png:- -thumbnail 1500 png:- \
| pngquant - --quality 64 > screenshot.png