Capturing screen shots and program interaction on UNIX and Linux systems: Part 3, Advanced graphical screen and window capture

Capturing screen images of applications is something that all technical writers, most graphical application developers, many technical marketing staff members, and even many users need to do. Modern UNIX® systems provide a number of different tools to capture graphical screens and single windows. This article, the final of three-part series, focuses on graphical tools that are available for most Linux® and UNIX systems. These tools make it easy to capture graphical portions of the screen to help illustrate both proper and improper program behavior.

Share:

William von Hagen, Systems Administrator, Writer, WordSmiths

William von Hagen has been a writer and UNIX systems administrator for more than 20 years and a Linux advocate since 1993. Bill is the author or co-author of books on subjects such as Ubuntu Linux, Xen Virtualization, the GNU Compiler Collection (GCC), SUSE Linux, Mac OS X, Linux file systems, and SGML. He has also written numerous articles for Linux and Mac OS X publications and Web sites. You can reach Bill at wvh@vonhagen.org.



26 April 2011

Also available in Chinese

As discussed in Part 1 and Part 2 of this series, capturing screen shots and a record of program interaction to illustrate application behavior is a common task for technical writers, technical marketing personnel, and for anyone who is filing a bug report on an application. Part 1 of this series focused on capturing program interaction, while Part 2 focused on image capture using command-line applications. This article, the last in the series, focuses on graphical applications for screen capture on UNIX® and Linux® systems.

UNIX and Linux graphical screen capture overview

All modern Linux and UNIX systems provide some sort of graphical desktop, which usually includes at least one graphical screen capture application—most often one that is specific to a particular desktop environment. For example, GNOME provides gnome-screenshot, and KDE provides KSnapshot. Both can capture individual dialogs, individual windows, and the entire screen. In addition to these somewhat simple, built-in screen and window capture utilities, several more advanced applications that support screen capture (such as GNU Image Manipulation Program (GIMP) and Shutter) are available for Linux and most UNIX systems.

Desktop-specific screen capture utilities

The GNOME and KDE desktop environments that are available for most Linux and UNIX systems both include screen shot utilities that leverage the capabilities of those environments. These utilities are fast, have relatively small memory requirements, and are easy to use. However, they do not provide all the screen capture options and capabilities of the more general-purpose applications discussed later in this article (see General screen capture utilities).

Using gnome-screenshot

The gnome-screenshot application is easy to execute and has minimal system requirements, making it an excellent choice for simple screen captures from the GNOME desktop. However, it can only capture images in Portable Network Graphics (PNG) format and does not provide the fine-grained control over object selection that is provided by applications such as GIMP and Shutter, as discussed later in this article.

The gnome-screenshot application is available on all GNOME-based Linux and UNIX computer systems. You can invoke it by doing one of the following:

  • Select the Applications > Accessories > Take Screenshot menu command.
  • Press the Print Screen key (sometimes abbreviated as PrtSc).
  • Press the Alt-Print Screen key combination.
  • Use the command line.

The gnome-screenshot application works slightly differently in each of these cases because they execute the command with different options.

Take Screenshot menu command

Selecting the Take Screenshot menu command starts the gnome-screenshot application in interactive mode (by using the --interactive command-line option). This displays the dialog shown in Figure 1.

Figure 1. The gnome-screenshot configuration dialog
Screen shot of the gnome-screenshot application's configuration dialog

Print Screen key

Pressing the Print Screen key invokes the gnome-screenshot application with no options, captures the entire screen, and displays the dialog shown in Figure 2. In this dialog, you can specify the name and location of the file in which you want to save the captured image.

Figure 2. The gnome-screenshot save screen shot dialog
Screenshot of the gnome-screenshot application's save dialog

Alt-Print Screen key combination

Pressing the Alt-Print Screen key combination (in other words, holding down the Alt key and pressing the Print Screen key) invokes the gnome-screenshot application with its -w option, captures the current window, and also displays the dialog shown in Figure 2.

Command line

Invoking the gnome-screenshot application from the command line enables you to specify any of its options. See the online reference information for the gnome-screenshot application—available by executing the man gnome-screenshot command—for information about all available options.

Using KSnapshot

KSnapshot is much more powerful and flexible than its GNOME equivalent, gnome-screenshot, but works only on KDE desktop systems or GNOME systems where the KDE desktop and associated libraries are also installed. It is an excellent choice for most of your screen capture needs from the KDE desktop; however, it still does not provide the fine-grained control over object selection provided by applications such as GIMP and Shutter, as discussed in the next section.

KSnapshot is available on all KDE-based Linux and UNIX computer systems. You can invoke it by doing one of the following:

  • Select the K Menu > Applications > Graphics > Take Screenshot menu command.
  • Press the Alt-F2 key combination and enter its name into the Run Command dialog.
  • Use the command line.

Starting KSnapshot in any of these ways initially displays the dialog, as shown in Figure 3.

Figure 3. The KSnapshot configuration and control dialog
Screenshot of the KSnapshot configuration and control dialog

After selecting the type of graphical object that you want to capture (from the Capture mode drop-down), an optional delay, and whether to include window decorations, click New Snapshot to capture the specified object or selected region. The new screen capture displays in the same dialog. You can then open it with an image editing application or save it to a file by clicking Save As and specifying the location and name of that file. In the Filter entry, you can specify the graphics file format you want to use when saving the new image—options include Encapsulated PostScript (EPS), Joint Photographic Experts Group (JPEG), PNG, X BitMap (XBM), X PixMap (XPM), and the Microsoft® Windows® BMP and Icon formats.

General screen capture utilities

The previous sections discussed the screen and image capture utilities that are provided by default with the GNOME and KDE desktops. Both of these provide advanced capabilities, such as being able to select manually a portion of the screen to capture and only capturing an image after some delay has elapsed, enabling you to select menus, show specific items in dialogs, and so on. Though these built-in applications are great, other Linux and UNIX applications provide advanced capabilities that are out of scope for basic, built-in applications.

The two applications discussed in the remainder of this article provide an impressive number of bells and whistles to keep even the most image-oriented writer happy. The first, GIMP, wasn't even designed as a screen/image capture application—it is an image editing application that includes screen capture capabilities. The second, Shutter, is a Perl script that provides a great user interface for specifying, selecting, and managing screen captures.

Using GIMP

GIMP is a popular raster image editing application that is available for almost all modern graphical computing platforms and provides many of the same capabilities as Adobe Photoshop. GIMP's integrated screen capture capabilities and sophisticated image editing capabilities make it a natural choice for screen captures and subsequent cleanup. Though I find Shutter to be an excellent and convenient screen capture application for GNOME systems, it's difficult to beat the combination of ubiquity and power that GIMP provides.

GIMP is available for all Linux distributions and is also available for most other operating systems, including Hewlett-Packard HP-UX, IBM® AIX®, Mac OS® X, Microsoft Windows, and Sun and Oracle Solaris. (GIMP for AIX is available on the AIX Toolbox for Linux Applications CDs.) GIMP provides sophisticated integrated image capture capabilities that make captured images available for editing immediately after they are captured.

The relationship between GIMP and the GNOME desktop is a common source of confusion. GIMP is not a GNOME application and, therefore, does not require that the GNOME desktop or all of the libraries that are used by GNOME be installed on your system. Instead, GNOME requires an underlying graphical user interface (GUI) toolkit called the GIMP Toolkit (GTK) that, as the name suggests, was originally developed as a central, reusable set of components and functions for GIMP. GIMP therefore only requires a modern version of GTK (GTK+, GTK2, and so on) and some X Window System libraries (or their equivalents on non-UNIX and non-Linux systems) to run on any platform.

To capture a screen image using GIMP, select the File > Create > Screenshot menu command, which displays the dialog shown in Figure 4.

Figure 4. The GIMP configuration and control dialog
Screenshot of the GIMP configuration and control dialog

This dialog enables you to specify whether you want to capture an image of the entire screen, a specific window or dialog, or a selectable region. It also provides controls that enable you to specify whether you want to capture window decorations when capturing a window and to specify a delay in seconds before the image will be captured.

After capturing an image, GIMP automatically opens that image for editing, as shown in Figure 5. When you are done making modifications to the captured image in GIMP, you can save the image to a file using the traditional File > Save As menu command.

Figure 5. A captured image in GIMP
Screenshot of a captured image in GIMP

Using Shutter

Shutter is a Perl script that requires the GNOME libraries and, thus, is typically run on systems that are running the GNOME desktop. Shutter was originally known as gscrot because it provided a GNOME wrapper for a command-line image capture application called scrot. However, Shutter is now completely standalone and no longer requires scrot. Shutter provides a great user interface for specifying, selecting, and managing screen captures.

You can start Shutter from the command line or by selecting the Applications > Accessories > Shutter command from the GNOME menus. When you first start Shutter, you may want to initially configure it through its Edit > Preferences dialog, shown in Figure 6.

Figure 6. Configuring Shutter
Screenshot of configuring Shutter

The various tabs in this dialog enable you to specify the naming scheme for the images that you capture (including a base name and image numbering), whether to include window decorations in captured window images, the format and location captured images should automatically be saved, and more.

After you finish configuring Shutter (or if you just want to use it out of the box), you can capture an image in one of the following ways:

  • Select the screen (or virtual screen) that you want to capture from the Full Screen drop-down menu to capture a full-screen image.
  • Select the name of the window that you want to capture from the Window drop-down menu to capture a specific window or dialog.
  • Select the icon to the right of the Window drop-down to capture a section of a window.
  • Select the icon to the right of the previous icon to capture a single menu or a set of cascading menus.

The captured image displays in Shutter, as shown in Figure 7.

Figure 7. Captured image in Shutter
Screenshot of a captured image in Shutter

Shutter automatically saves the images it captures based on the naming scheme identified in its Preferences dialog. You can also specify a numbering scheme—this is convenient if you are capturing a series of images that must appear in that order. It also displays all of your screen captures in separate panes within its main dialog, which is also convenient if you want to verify that you have captured all of the images that you need for explaining or documenting the sequence of windows, dialogs, and so on, that are associated with a specific process. For more information about Shutter, see Resources.

Summary

The graphical screen capture utilities discussed in this article simplify screen capture for users who do not need (or want) to work from the command line.

The default graphical screen capture utilities provided on GNOME and KDE systems are convenient for simple screen captures, but GIMP and Shutter provide some significant advantages when you know that you need to touch up those images or when capturing multiple images.

GIMP is great as a standard screen capture tool because it is available for every modern desktop computer system. I tend to use GIMP everywhere except for GNOME systems, where I use Shutter because of its prefixing, numbering, and sophisticated selection capabilities.

Resources

Learn

  • The gnome-screenshot package is part of the GNOME Utilities package and is installed by default on all systems that are running the GNOME desktop.
  • KSnapshot is installed by default on all systems that are running the KDE desktop.
  • The AIX and UNIX developerWorks zone provides a wealth of information relating to all aspects of AIX systems administration and expanding your UNIX skills.
  • New to AIX and UNIX? Visit the New to AIX and UNIX page to learn more.
  • Browse the technology bookstore for books on this and other technical topics.

Get products and technologies

  • GIMP is a raster image editing application that also provides dialog, window, and screen capture capabilities.
  • Shutter is a powerful and easy-to-use dialog, window, and screen capture application with many custom and powerful capabilities.

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into AIX and Unix on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=AIX and UNIX
ArticleID=650442
ArticleTitle=Capturing screen shots and program interaction on UNIX and Linux systems: Part 3, Advanced graphical screen and window capture
publish-date=04262011