The Lazy Man's Way to Linux Screenshots
Copyright (C) 2000-2001 by Steve
Litt
This page documents two different methods of taking Linux screenshots:
Because the import method is a one step method, and
because you can use it to modify the resolution, it is superior.
The Import Screenshot Method
The following assumes a Linux box named servername and a user named
username, with which you do your examples for your documentation.
-
From the console, log into your xserver as the same user as you're doing
your Samba testing with (username)
-
Make sure you're at the screen resolution and color depth specified by
your publisher, or greater. Best images occur when the screen resolution
and color depth *exactly* match your publisher's specification.
-
Close all windows, move all buttonbars to the side.
-
From another box, open a telnet into your Samba server, using user username.
This can also be done with a virtual terminal.
-
Run the program for which a screenshot must be taken, from the command
prompt in the telnet session. The trick is to use the display option, i.e.
----
-
$ netscape -display servername:0 &
-
Note that unless you have more than 1 keyboard or 1 monitor attached to
the server, the display is always boxname:0
-
On the server X console, do whatever you need to do to get the shot lined
up. This includes setting exactly the right window as active, putting the
mouse pointer out of the way or pointing to a menu selection, etc.
-
From the telnet session, logged in as username (this will fail otherwise),
take your screenshot with this command:
-
$ import -window root -display servername:0 myfile01.pcx
-
Repeat the preceding steps for all your screenshots, using different filenames.
Finally, since you're in as username, you don't have to ftp them back and
worry whether you have ascii or binary. Just Samba them back :-)
Resolution and Color Reduction
You can use options in the import utility to reduce the resolution
and colors of the screenshot. It's important to note that doing so may
decrease the image quality below that you'd obtain reducing the Linux box's
resolution and color. Check with your publisher to see if on the fly resolution
and color reduction are acceptable.
To reduce the resolution, use the -geometry option as follows:
$ import -window root -geometry 640:480 -display servername:0 myfile01.pcx
To reduce the number of colors, use the -colors option. Typically,
color reduction leads to speckling and other problems. These can be minimized
with the +dither option. The following command takes a screenshot
and reduces it to 16 colors:
$ import -window root -colors 16 +dither -display servername:0 myfile01.pcx
It's important to note that although the number of colors are reduced,
the number of bits is not reduced. It takes a separate conversion to do
that. The convert command with the -depth option can reduce the
color depth to 8 bits.
Hope this works as well for you as it does for me. It consistently gives
me the screenshots required by my documents. Obviously, it doesn't help
with Windows screenshots.
Steve Litt
The xwd Screenshot Method
The following assumes a Linux box named servername and a user named username,
with which you do your examples for your documentation.
-
From the console, log into your xserver as the same user as you're doing
your Samba testing with (username)
-
Make sure you're at the screen resolution and color depth specified by
your publisher.
-
Close all windows, move all buttonbars to the side.
-
From another box, open a telnet into your Samba server, using user username.
This can also be done with a virtual terminal.
-
Run the program for which a screenshot must be taken, from the command
prompt in the telnet session. The trick is to use the display option, i.e.
----
-
$ netscape -display servername:0 &
-
Note that unless you have more than 1 keyboard or 1 monitor attached to
the server, the display is always boxname:0
-
On the server X console, do whatever you need to do to get the shot lined
up. This includes setting exactly the right window as active, putting the
mouse pointer out of the way or pointing to a menu selection, etc.
-
From the telnet session, logged in as username (this will fail otherwise),
take your screenshot with this command:
-
$ xwd -display servername:0 -root > myfile.dmp
-
Repeat the preceding steps for all your screenshots.
When done, you can mass convert all the .dmps to .pcx's with this script,
run while in the directory containing the .dmp files:
#!/usr/bin/perl -w
#################################################################
# mconvert.pl by Steve Litt. Copy freely, N O
W A R R A N T E E
#################################################################
my(@files) = glob "*.dmp";
my($src);
my($dst);
foreach $src (@files)
{
$src =~ m/(.+)\.dmp/;
$dst = $1 . ".pcx";
print "$src-->$dst...";
system("convert $src $dst");
print "\n";
}
print "DONE.\n"; |
Note that you can change the destination file type by replacing the
".pcx" in $dst = $1 . ".pcx"; with whatever file type is appropriate.
Finally, since you're in as username, you don't have to ftp them back
and worry whether you have ascii or binary. Just Samba them back :-)
Cropping Your Screenshot with Gimp
Always crop before you color reduce!!! Otherwise, extraneous colors
will muddy your color reduction!!!
Pull whatever.png up in Gimp. Press Shift-C on the keyboard to begin
a crop, and drag an area around the window or menu or other point of interest.
Make sure the area is "loose", meaning it includes material outside the
needed window or whatever. Now press the crop button, and the image is
cropped to the area of interest plus a small extraneous area around it.
Elapsed time, maybe 10 seconds. Now go in for the accurate crop.
Press the equal sign on the keyboard several times (8 is good), to magnify
the image. Use the scroll bars to get to the upper left corner of the image
where you can see the upper left corner of the area of interest. Press
Shift-C on the keyboard, and position the centers of the crosshair arms
to coincide with the edges of the area of interest. Press the left mouse
button and drag right and down. Note that the entire screen scrolls as
you drag. Drag until you can position the center of the crosshairs on the
edges comprising the lower right corner, then release the mouse button.
Click the crop button, and you've cropped accurately to the pixel. The
fact that you magnified the screen with the equal sign is what allowed
you to-the-pixel accuracy. Now reduce magnification by repeated presses
of the minus key. Save the image.
Color Reducing the Screenshot
Always crop before you color reduce!!! Otherwise, extraneous colors
will muddy your color reduction!!!
Create the following script. I call it reduce16.sh:
#!/bin/sh
convert -depth 24 $1 $1
convert -depth 16 $1 $1
convert -depth 8 $1 $1
convert -colors 16 $1 $1
|
The preceding script takes a graphic file as its single argument. It
reduces it to 24 bit color, then 16, then 8, then finally down to 16 total
colors. Why all the steps when the very last statement would do the entire
reduction?
The problem is that this reduction is accomplished by algorithms that
map similar colors together. If it needs to map thousands of colors down
to 16, some very bad compromises will be made. But if it maps thousands
to hundreds to 256 to 16, there will be no drastic mappings, and each step
will do the right thing.
In fact, if you reduce directly to 16, the graphic might look pretty
good in Gimp or Paintshop pro, but very bad in Netscape, where you really
want it to look good. So run the graphic through reduce16.sh, and it will
be perfect for a web based screenshot.
You've reduced the area to what you want, but bandwidth considerations
require a reduction to 16 colors, and that's not intuitive or easy. Read
on...
Summary
Hope this works as well for you as it does for me. It consistently gives
me the screenshots required by my documents. Obviously, it doesn't help
with Windows screenshots.
Steve Litt
See also: [ Linux Library | Troubleshooters.Com
| Email Steve Litt | Copyright
Notice ]
Copyright
(C)2000-2001 by Steve Litt. -- Legal