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
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).
- 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
The author of mozgrab.pl used this system in December 2004 for developing and
- Debian GNU/Linux Woody
- GLibc 2.2.5
- Perl 5.6.1
- XFree86 Version 18.104.22.168, 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)
- 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
lorg.ppm to some other image file format, for
convert lorg.ppm lorg.jpg
./mozgrab.pl to get to know more options.
- can start up Mozilla automatically
- does not grab window manager and browser decorations
- can make the grab taller than a single screen
- 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
- 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.