mozgrab.pl: a web page screen shot grabber using Mozilla
mozgrab.pl is a UNIX command-line utility that can be used to make automated
screen shots of web pages, without web browser menus or other decorations.
The screen shot can be up to 30 pages (32000 pixels) high. It invokes Mozilla
to download and show a web page, and then mozgrab.pl makes screen shots and
concatenates them vertically to form a PPM file.
The newest version of this web page is available from
http://www.math.bme.hu/~pts/mozgrab.html
Developing mozgrab.pl was the homework assignment
of the author
for the ATHENS ENSAM3 course in November 2004.
The e-mail address of the author is
Szabó Péter (
the last character (u) of
the e-mail address was removed from the link -- this prevents spam bots from
recognising the address).
Requirements
System
- a UNIX system, preferably Linux
- a Bourne-compatible shell
- Perl 5
- a running X11 session (Xvnc and Xnest are also OK)
- Mozilla, Firefox or Galeon on
$PATH
of the local system
- the netpbm utilities
- X11 include files
- GCC
Commands required
perl
sh
ldd
mozilla
, firefox
or galeon
gcc
ps
xwd
xwdtopnm
pnmdepth
Test system
The author of mozgrab.pl used this system in December 2004 for developing and
testing mozgrab.pl:
- Debian GNU/Linux Woody
- GLibc 2.2.5
- Bash
- Perl 5.6.1
- XFree86 Version 4.1.0.1, protocol Version 11, revision 0, vendor release 6510
- Mozilla 1.6-6 Gecko/20040530
- netpbm 2:9.20-8
- gcc version 2.95.4 20011002 (Debian prerelease)
Usage
- Download and extract mozgrab.pl
- Ensure that the file mozgrab.pl is executable.
- Ensure that all the requirements are met.
- Start an X11 session.
- Start an XTerm or other terminal emulator.
- Change to the directory containing mozgrab.pl
- Try grabbing, for example issue the command
./mozgrab.pl --url=http://www.linux.org/ --outfile=lorg.ppm
- View the created file
lorg.ppm
in your favourite image
viewer, for example xv lorg.ppm
,
display lorg.ppm
,
eeyes lorg.ppm
,
gimp lorg.ppm
,
xzgv lorg.ppm
.
- Convert
lorg.ppm
to some other image file format, for
example convert lorg.ppm lorg.jpg
- Run
./mozgrab.pl
to get to know more options.
Features
- can start up Mozilla automatically
- does not grab window manager and browser decorations
- can make the grab taller than a single screen
Limitations
- web pages taller than 32000 pixels will be cropped (this is an
inherent X11 limitation)
- the amount of time spent waiting for Mozilla to render the pages are
hard-coded
- a running X11 session is required
- two instances of mozgrab.pl cannot run concurrently
- a local copy of Mozilla is required
- Mozilla sometimes fails to render the page (especially the letters) --
mozgrab.pl has to be run again.