Taking screenshots in Linux
So you've been reading about Linux on ghacks for a few months now and you'veÂ noticed plenty of screenshots or images of applications in action. Now it's time you found out just how those images are taken. No it's not magic, but in one instance it's ImageMagick. Actually there are a few ways to take screenshots in Linux, ranging from a simple keypress to a command line tool.
In this article you will learn how to take screenshots with the help of The Gimp, the GNOME menu, the Print Screen button, and ImageMagick. Each way has its advantages, so it'll be up to you to decide which method suits you best. With that said, lets' dive in head first.
I wanted to start with this method because it can be a little flaky. The primary issue is that ImageMagick has trouble with Compiz. If you're not running Compiz, you won't have any issues with this method. Otherwise you'd be best served to skip down to The GIMP.
One of the benefits of this method is you can use it to grab screenshots automatically. You could even set up a cron job to take screen shots at specific times, or log into a machine remotely and snap a shot. I won't get into the "why" you would want to do this - decide that yourself.
The basic command for taking a snapshot with ImageMagick is:
Pretty simple. The only catch with the above command is that you will have to specify what portion of the screen to grab. When you issue that command a cross-hair will appear which you click and drag to select what portion of the screen to grab. There is an easier way. If you want to take this screenshot without interaction you issue the command:
import -window root FILENAME.png
What the above command does is take a screenshot of the root window (that's the entire screen basically.) The screenshot will be saved (in the case of the example above) as FILENAME.png
This one is simple (and not much different than using the GNOME menu)Â you press the Print Screen button. When you do a window will open (see Figure 1) asking you to give the file a name, decide on a destination, and click save.Â You can save the screenshot in .jpg, .png (default), .tiff, .gif, and .bmp formats. From this same window you can also copy the image to the clipboard for later use.
If you look in the Accessories subment of the GNOME Applications menu you will see the entry "Take Screenshot". If you click on this the same window will open that opened when you hit the Print Screen key. This works in the exact same way. If, for some reason, you have a different keyboard mapping or a Print Screen key that does not work, this menu entry is sure to work.
The GIMP is my standard means for snapping screenshots.Â Within The GIMP click on the File menu and then click on the Create submenu. From within the Create menu click the Screenshot entry which will open up the screenshot dialog (see Figure 1).
There are three types of screenshots you can take:
Single Window: This will grab only the window you click on after you click the Snap button.
Entire Screen: This will grab the entire screen after you click the Snap button.
Select a Region: This allows you to select the portion of the screen you want to grab after you click snap.
You can also configure a delay (in seconds) which will allow you to open up menus or take an action to grab.
When using The GIMP for screenshots you will have to save the image manually. But you can also edit the image before you save it.
As you can see there are a number of ways to grab a screenshot in the Linux desktop. Each method is simple and should have you snagging screenshots all day long.Advertisement