screen captures in X

Subject: screen captures in X
From: Glen Accardo <glen -at- SOFTINT -dot- COM>
Date: Tue, 21 Jun 1994 13:40:16 CDT

One of our developers forwarded this to me. It is pretty much everything
you never wanted to know about screen captures in X.

Subject: 21)! How do I make a screendump or print my application (including

The xwd client in the X11 distributions can be used to select a window
or the background. It produces an XWD-format file of the image of that
window. The file can be post-processed into something useful or printed with
the xpr client and your local printing mechanism. To print a screendump
including a menu or other object which has grabbed the pointer, you can use
this command:
csh% sleep 10; xwd -root > output.xwd &
and then spend 10 seconds or so setting up your screen; the entire current
display will be saved into the file output.xwd. Note that xwd also has an
undocumented (before R5) -id flag for specifying the window id on the
command-line. [There are also unofficial patches on to xwd for
specifying the delay and the portion of the screen to capture.]

Two publicly-available programs which allow interactive definition of
arbitrary portions of the display and built-in delays are asnap and xgrabsc.

xgrabsc is a free screendump program that provides multiple selection
styles and several output formats. Selection styles include xwd-style point
and click, dragging a rectangle over an arbitrary portion of the screen,
timed snapshots for menu capturing, and keyboard-based selection. Output
formats are xwd, XPM (v1 and 2), bitmap, puzzle, and monochrome, greyscale,
and color Postscript. Postscript output can be in ready-to-print true-scale
form or encapsulated for inclusion in Frame, xfig, and other programs that
accept EPS graphics. There are several versions of xgrabsc; version 2.3,
available on [9/93] is the most recent. xgrab, part of the
package, is an interactive front-end to xgrabsc.

xsnap includes some asnap features and supersedes it; it also renders
XPM output [version unknown]. It is available on or;
see xsnap-pl2.tar.Z.
A screen-dump and merge/edit program combining features of xwd and xpr
is available from as xdump1.0.tar.Z. Information:
soft-eng -at- cs -dot- uwm -dot- edu -dot-
xprint, by Alberto Accomazzi (alberto -at- cfa -dot- harvard -dot- edu) is available
from ( as /pub/wipl/xprint.export-2.1.tar.Z.
The package allows users to create encapsulated color PostScript files which
will print on any PostScript Level-1 compliant printer (black and white or

To post-process the xwd output of some of these tools, you can use
xpr, which is part of the X11 distribution (moved to contrib in R6). Also on
several archives are xwd2ps and XtoPS, which produce Encapsulated PostScript
with trimmings suitable for use in presentations (see and contrib/ImageMagick2.3.7.tar.Z). Also
useful is the PBMPLUS/Netpbm package on many archive servers; and the Xim
package contains Level 2 color PostScript output.

The XV program can grab a portion of the X display, manipulate it, and
save it in one of the available formats. ImageMagick has similar


Bristol Technology (info -at- bristol -dot- com, 203-438-6969) offers Xprinter
2.0, an Xlib API for PostScript and PCL printers; a demo is on in

ColorSoft 9619-459-8500) offers OPENprint package includes a screen-
capture facility, image-processing, and support for PostScript and
non-PostScript printers.

Some vendors' implementations of X (e.g. DECWindows and OpenWindows)
include session managers or other desktop programs which include "print
portion of screen" or "take a snapshot" options. Some platforms also have
tools which can be used to grab the frame-buffer directly; the Sun systems,
for example, have a 'screendump' program which produces a Sun raster file.
Some X terminals have local screen-dump utilities to write PostScript to a
local serial printer.

Some vendors' implementations of lpr (e.g. Sony) include direct
support for printing xwd files, but you'll typically need some other package
to massage the output into a useful format which you can get to the printer.

Subject: 22) How do I make a color PostScript screendump of the X display?

If you need color PostScript in particular, you can
- grab the screen-image using a program which can produce color
PostScript, such as xgrabsc, xprint, and xv
- grab the screen-image using xwd and post-process xwd into color PS.
You can do this using xwd2ps or the XtoPS program from the ImageMagick
distribution. The PBMPLUS/Netpbm package is also good for this, as is the Xim

Subject: 23) How do I make a screendump including the X cursor?

This can't be done unless the X server has been extended. Consider
instead a system-dependent mechanism for, e.g., capturing the frame-buffer.

Subject: 24) How do I convert or view Mac/TIFF/GIF/Sun/PICT/img/FAX images in

The likeliest program is an incarnation of Jef Poskanzer's useful++
Portable Bitmap Toolkit, which includes a number of programs for converting
among various image formats. It includes support for many types of bitmaps,
gray-scale images, and full-color images. PBMPLUS has been updated recently;
the most recent version [12/91] is on in

Netpbm is based on the PBMPLUS 10dec91 release, with many additions
and improvements. It is intended to be portable to many platforms while
allowing for conversion of images between a variety of formats. The latest
sources are on several sites, including (
and ( Contact oliver -at- fysik4 -dot- kth -dot- se to be
added to the netpbm mailing list.

Another tool is San Diego Supercomputing Center's IMtools ('imconv' in
particular), which packages the functionality of PBM into a single binary.
It's available anonymous ftp from (

Useful for viewing and converting some image-formats is Jim Frost's
xloadimage; the most recent [11/93] is on in
contrib/xloadimage.4.1.tar.Z. Graeme Gill's updates to an earlier version of
xloadimage are also on; see xli.README and xli.tar.Z.uu; version
1.15 was released 7/93.

xv (X Image Viewer), written by bradley -at- cis -dot- upenn -dot- edu (John Bradley),
can read and display pictures in Sun Raster, PGM, PBM, PPM, X11 bitmap, TIFF,
GIF and JPEG. It can manipulate on the images: adjust, color, intensity,
contrast, aspect ratio, crop). It can save images in all of the aforementioned
formats plus PostScript. It can grab a portion of the X display, manipulate on
it, and save it in one of the available formats. The program was updated 5/92;
see the file contrib/xv-2.21.tar.Z on Version 3.00 [5/93] is
distributed as shareware.

The Fuzzy Pixmap Manipulation, by Michael Mauldin
(mlm -at- nl -dot- cs -dot- cmu -dot- edu). Conversion and manipulation package, similar to
PBMPLUS. Version 1.0 available via FTP as,, and

The Img Software Set, by Paul Raveling <raveling -at- venera -dot- isi -dot- edu>,
reads and writes its own image format, displays on an X11 screen, and does
some image manipulations. Version 1.3 is available via FTP on as
contrib/img_1.3.tar.Z, along with large collection of color images.

The Utah RLE Toolkit is a conversion and manipulation package similar
to PBMPLUS. Available via FTP as*,*, and*.

Xim, The X Image Manipulator, by Philip Thompson, does essential
interactive displaying, editing, filtering, and converting of images. There is
a version in the X11R4 contrib area; but a more recent version (using R4 and
Motif 1.1) is available from ( Xim reads/writes gif,
xwd, xbm, tiff, rle, xim, (writes level 2 eps) and other formats and also has
a library and command-line utilities for building your own applications.

ImageMagick by cristy -at- dupont -dot- com is an X11 package for display and
interactive manipulation of images. Includes tools for image conversion,
annotation, compositing, animation, and creating montages. ImageMagick can
read and write many of the more popular image formats (JPEG, TIFF, PNM,
Postscript, ...). Available via FTP from as
contrib/ImageMagick2.3.6.tar.Z. [1/94]

xtiff is a tool for viewing a TIFF file in an X window. It was
written to handle as many different kinds of TIFF files as possible while
remaining simple, portable and efficient. xtiff illustrates some common
problems with building pixmaps and using different visual classes. It is
distributed as part of Sam Leffler's libtiff package and it is also available
on and comp.sources.x. [dbs -at- decwrl -dot- dec -dot- com,10/90] xtiff 2.0 was
announced in 4/91; it includes Xlib and Xt versions.

A version of Lee Iverson's (leei -at- McRCIM -dot- McGill -dot- EDU) image-viewing tool
is available as contrib/vimage-0.9.3.tar.Z on The package also
includes an ImageViewPort widget and a FileDialog widget. [12/91;5/92]

The Andrew User Interface System (version 5.2 and later) provides an
image inset which can view many image formats. Like all Andrew insets, an
image can be incorporated in a a document or sent in email via the MIME
standard. The following formats can be read: Sunraster, GIF, Xbitmap, TIFF,
Xpixmap, JPEG, PBM, XWD.

The LUG (Libreria de Utilidades Graficas) is a library of subroutines
offering several routines for the manipulation of images in several different
formats. The distribution includes viewers for several different platforms. The
distribution is on (

The X Image Extension (XIE), an X Consortium standard in R6, provides
facilities for transmitting displaying fax (G3, G4), TIFF, and JPEG images.

[some material from Larry Carroll (larryc -at- poe -dot- jpl -dot- nasa -dot- gov), 5/91]

glen accardo glen -at- softint -dot- com
Software Interfaces, Inc. (713) 492-0707
Houston, TX 77084

Did the Corinthians ever write back?

Previous by Author: How would you....?
Next by Author: a SQL / an SQL
Previous by Thread: Unix screen capture process
Next by Thread: contract editing (response summary)

What this post helpful? Share it with friends and colleagues:

Sponsored Ads