Skip to main content

How to Take a Screenshot in Linux (Ubuntu) | Web Design Tips

Popularity Report

Total Popularity Score: 0

Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Rank

Bookmark History

Saved by 6 people (-3 private), first by anonymouse user on 2006-11-08


Public Sticky notes

How to Take a Screenshot in Linux With the Terminal (ImageMagick)

My favorite way of taking screenshots is with ImageMagick in the terminal. If you need a delay before taking the screenshot (for example, to get a screenshot of a menu that would disappear if you took a screenshot with GNOME) ImageMagick is the best way.

First, make sure you have ImageMagic installed: type import -version in the terminal. If ImageMagick is installed, you will see the ImageMagick version number. I don't think Ubuntu comes with ImageMagick. To install ImageMagick in Ubuntu (or any Debian-based distro), just type sudo apt-get install imagemagick.

To take a screenshot in the terminal with ImageMagick, type the following line into a terminal and then click-and-drag the mouse over a section of the screen:

import MyScreenshot.png

GNOME will beep once when the screenshot begins, and once again when the screenshot is complete. Then type eog MyScreenshot.png in the terminal to view your screenshot. "eog" is the command to start Eye of GNOME.

To capture the entire screen after a delay (so you can open some menus or whatever), type sleep 10; import -window root MyScreenshot2.png. The first part of that line, sleep 10; will give you a 10 second delay before the screenshot begins. The next part, import -window root, tells ImageMagick to import the "root" window — that is, the entire screen. The last part MyScreenshot2.png is the name of your screenshot.

Another example of taking a screenshot in Linux with the terminal

The following command will wait for 15 seconds, take a screenshot, and then open the screenshot in the GIMP for editing:

sleep 15; import -window root MyScreenshot3.png; gimp MyScreenshot3.png;

You can also manipulate the screenshot with ImageMagick as you take it. For example, the following line will take a screenshot and resize the image to a width of 500 pixels:

import -window root -resize 500 AnotherScreenshot.png

For more information on how to take screenshots in the terminal with ImageMagick, type man imagemagick in the terminal. You can also type import -help to get a list of options for the import command.

Highlighted by iphigenie

sudo apt-get install imagemagick

Highlighted by jeanmichelg