Pamcrater User Manual

Pamcrater User Manual



pamcrater - create cratered terrain by fractal forgery


    $ pamcrater | pamshadedrelief | pamx

    $ pamcrater -number=500000 -height=1000 -width=1000 >craters.pam



[-number n]

[-height pixels]

[-width pixels]



This program is part of Netpbm(1)

pamcrater creates a PAM image which is a terrain map of cratered terrain. The terrain is as if a given number of impacts into a surface create craters with random position and size.

The size distribution of the craters is based on a power law which results in many more small craters than large ones. The number of craters of a given size varies as the reciprocal of the area as described on pages 31 and 32 of Peitgen and Saupe[1]; cratered bodies in the Solar System are observed to obey this relationship. The formula used to obtain crater radii governed by this law from a uniformly distributed pseudorandom sequence was developed by Rudy Rucker.

A terrain map is a two dimensional map of terrain elevations. the PAM image that pamcrater produces is therefore not a visual image but a depth-one image of tuple type ’elevation’, with the sample value being proportional to an elevation.

You can visualize the terrain map by generating a shaded relief image of it with pamshadedrelief.

High resolution images with large numbers of craters often benefit from being piped through pnmsmooth. The averaging performed by this process eliminates some of the jagged pixels and lends a mellow ‘‘telescopic image’’ feel to the overall picture.

pamcrater generates only small craters, which are hemispherical in shape (regardless of the incidence angle of the impacting body, as long as the velocity is sufficiently high). Large craters, such as Copernicus and Tycho on the Moon, have a ‘‘walled plain’’ shape with a cross-section more like:

/\ /\
_____/ \____________/\____________/ \_____

Larger craters should really use this profile, including the central peak, and totally obliterate the pre-existing terrain.

The randomness in the image is limited before Netpbm 10.37 (December 2006) -- if you run the program twice in the same second, you may get identical output.


All options can be abbreviated to their shortest unique prefix.

Causes pamcrater to generate n craters. If you do not specify -number, it generates 50000 craters. Don’t expect to see them all! For every large crater there are many, many more tiny ones which tend simply to erode the landscape. In general, the more craters you specify, the more realistic the result; ideally you want the entire terrain to have been extensively turned over again and again by cratering. High resolution images containing five to ten million craters are stunning but take longer to create.

-height height

Sets the height of the generated image to height pixels. The default height is 256 pixels.

-width width

Sets the width of the generated image to width pixels. The default width is 256 pixels.


This is the seed for the random number generator that generates the pixels.

Use this to ensure you get the same image on separate invocations.

By default, pamcrater uses a seed derived from the time of day and process ID, which gives you fairly uncorrelated results in multiple invocations.

This option was new in Netpbm 10.61 (December 2012).


Real craters have two distinct morphologies.


pamshadedrelief(1) , ppmrelief(1) , pnmsmooth(1)

pam(5) ,


Peitgen, H.-O., and Saupe, D. eds., The Science Of Fractal Images, New York: Springer Verlag, 1988.


pgmcrater, from which this is derived, was written by John Walker:

John Walker
Autodesk SA
Avenue des Champs-Montants 14b
038/33 88 15
038/33 76 33

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, without any conditions or restrictions. This software is provided ’as is’ without express or implied warranty.


John Walker wrote pgmcrater in 1991 and it was included in Pbmplus. pgmcrater did the equivalent of pamcrater | pamshadedrelief. In Netpbm 10.68 (September 2014), Bryan Henderson split the functions of pgmcrater into two programs, one (pamcrater) to compute elevations, and the other (pamshadedrelief) to generate a shaded relief visual image showing those elevations. Bryan did this because it is more in keeping with Netpbm’s modular architecture, and because the pamshadedrelief might be useful with other inputs.

(Like all Netpbm programs, pgmcrater was not static between the two events described above; minor changes, including replacement of most of the code, happened in between).

The original 1991 pgmcrater manual contains the following:

If you like this kind of stuff, you may also enjoy ’James Gleick’s Chaos--The Software’ for MS-DOS, available for $59.95 from your local software store or directly from Autodesk, Inc., Attn: Science Series, 2320 Marinship Way, Sausalito, CA 94965, USA. Telephone: (800) 688-2344 toll-free or, outside the U.S. (415) 332-2344 Ext 4886. Fax: (415) 289-4718. ’Chaos--The Software’ includes a more comprehensive fractal forgery generator which creates three-dimensional landscapes as well as clouds and planets, plus five more modules which explore other aspects of Chaos. The user guide of more than 200 pages includes an introduction by James Gleick and detailed explanations by Rudy Rucker of the mathematics and algorithms used by each program.


Personal Opportunity - Free software gives you access to billions of dollars of software at no cost. Use this software for your business, personal use or to develop a profitable skill. Access to source code provides access to a level of capabilities/information that companies protect though copyrights. Open source is a core component of the Internet and it is available to you. Leverage the billions of dollars in resources and capabilities to build a career, establish a business or change the world. The potential is endless for those who understand the opportunity.

Business Opportunity - Goldman Sachs, IBM and countless large corporations are leveraging open source to reduce costs, develop products and increase their bottom lines. Learn what these companies know about open source and how open source can give you the advantage.

Free Software

Free Software provides computer programs and capabilities at no cost but more importantly, it provides the freedom to run, edit, contribute to, and share the software. The importance of free software is a matter of access, not price. Software at no cost is a benefit but ownership rights to the software and source code is far more significant.

Free Office Software - The Libre Office suite provides top desktop productivity tools for free. This includes, a word processor, spreadsheet, presentation engine, drawing and flowcharting, database and math applications. Libre Office is available for Linux or Windows.

Free Books

The Free Books Library is a collection of thousands of the most popular public domain books in an online readable format. The collection includes great classical literature and more recent works where the U.S. copyright has expired. These books are yours to read and use without restrictions.

Source Code - Want to change a program or know how it works? Open Source provides the source code for its programs so that anyone can use, modify or learn how to write those programs themselves. Visit the GNU source code repositories to download the source.


Study at Harvard, Stanford or MIT - Open edX provides free online courses from Harvard, MIT, Columbia, UC Berkeley and other top Universities. Hundreds of courses for almost all major subjects and course levels. Open edx also offers some paid courses and selected certifications.

Linux Manual Pages - A man or manual page is a form of software documentation found on Linux/Unix operating systems. Topics covered include computer programs (including library and system calls), formal standards and conventions, and even abstract concepts.