fractile(1) fractile(1)
NAME
fractile - generate fractal texture images
SYNTAX
fractile [-m macro] [-v] [-r] [-s [size,][first,]last] [-i illum] [-p
[colors,]palette] [-t travel] [-f floodlevel] [-c crushlevel] [-e
emphasis] [-l lightcolor] [-d darkcolor] [-w watercolor]
[filename[.gif]]
DESCRIPTION
This program uses fractal techniques to generate a texture image map.
This is implemented in such a way that the resulting images will fit
together well as background tiles, e.g. for a Netscape background or
the root window of an X terminal. Examples are provided below which
generate images which look like aerial photographs, clouds, or
whatever.
The algorithm begins with a square array for storing altitudes of
points. One initial point is chosen to have an altitude of 0.5. It
then interpolates other points between that initial point and its
tiled dopplegangers, possibly with a small amount of noise factored
in. These interpolations continue until every point in the array has
been assigned an altitude value. Because of the way the algorithm
works, the array must be square and the length of the array's sides
must be a power of two. The -s flag (described below) allows you to
specify the power, and also control which refinement steps are
subjected to noise.
The altitudes are then converted to colors in an image. fractile
supports two ways to do this; see the discussion of -ih below.
The image is then either loaded into the root window of your X
terminal, or written out to a file. If it is written to a file,
fractile will use Microsoft's BMP image file format if the file name
ends with ".bmp", or Compuserve's GIF format for any other name. If
you give a name that doesn't have a file name extension, then fractile
will add ".gif" onto the end of it. As a special case, if the name is
just plain "-" then fractile will write the GIF image data to stdout
instead of a file.
OPTIONS
-v Causes fractile to display its version number, and then exit.
-r Normally fractile will use weighted random dithering when it
wants to plot a pixel in a color which falls between two
allocated colors. With -r the pixel will just be rounded to the
nearest allocated color.
- 1 - Formatted: June 9, 2026
fractile(1) fractile(1)
-s [size,][first,]last
This option allows you to specify one, two, or three numbers
which control the fractal terrain generator algorithm. If you
specify two numbers, then they will be considered to be size and
last if the first number is larger than the second, or first and
last otherwise.
Each side of the image will be 2^size pixels long. The default
value of first is 1, and the default last value is 7. The size
defaults to the same value as last. Since the default value of
last is 7, the default size will also usually be 7 which gives us
a 128x128 image.
When the fractal altitude generator algorithm is doing its
"successive refinement with noise" thing, it won't use noise for
levels before first or after last. Making first greater than 1
results in flatter terrain. Making last smaller than size will
cause the terrain to look lumpy and less detailed.
-i illumination
Normally the images produced are illuminated as though there was
an illumination source to the Northwest; I.e., the Northwestern
slopes are shown in lighter colors than the Southeastern slopes.
This option provides a way for you to specify some other compass
heading to the illumination source. For example, -ine will cause
Northeast slopes to be plotted in the lighter color.
You aren't limited to the basic compass headings, though.
Internally, fractile computes a point's color by finding the
altitude difference between that point and a neighboring point.
Specifying an illumination source of "nw" tells fractile to find
that neighbor by moving North one pixel and then West one pixel.
You can also specify an illumination source such as "nnnnnnnn" or
"n8" to find the neighbor 8 pixels to the North. Tricks like
this usually make the resulting image look simpler, or perhaps
blurry... but sometimes the effect can be surprising.
One special case is -ih, which causes each point's altitute to be
directly converted to a color value, like a topological map.
This tends to produce much smoother looking images than the
default lighting style.
And finally, -irandom will cause fractile to randomly choose one
of "nw", "n", "ne", "h" or "neeeee" for the illumination source.
The "neeeee" value is less likely to be chosen than the other
four possibilities.
-p [colors,]palette
The palette can have anywhere from 2 to 64 color values, not
counting the optional water color. If you intend to use the
image as a root window image on a pseudo-color X-terminal, then
- 2 - Formatted: June 9, 2026
fractile(1) fractile(1)
you might want to limit the image to very few colors.
Surprisingly, even 2 colors can produce good looking images. The
default palette size is 4.
Normally the palette is precisely filled with colors interpolated
between the light color and the dark color (see -l and -d, below)
so the number of colors is equal to the palette size. However,
you can specify a smaller number of colors, in which case the
palette is filled with reflections of those colors. This is
described in more detail in the "Colors" section, below.
-t travel
This option controls how colors are interpolated between the
light and dark colors, by defining which path to travel on the
color wheel from the dark color to the light color. There are
three paths: chord, cw, and ccw.
The default value is chord, which causes fractile to travel in a
straight line between the two colors. The cw and ccw values
cause it to travel in a clockwise or counterclockwise spiral,
respectively, from the dark color to the light color. For
example, if the dark color is red and the light color is green,
the path travels through the following colors:
chord: red -> graybrown -> green
cw: red -> orange -> yellow -> green
ccw: red -> magenta -> blue -> green
Additionally, you can use -trandom to have fractile randomly
choose one of those three paths.
-f flood
If you specify a flood level, then any points with an altitude
lower than this level will be drawn in the water color. It
should be a number between 0.0 and 1.0. A typical value would be
around 0.4, but of course it depends on the height of the
randomly generated terrain. By default, no pixels are drawn in
the flood color.
-c crush
The crush level allows you to shear off mountain peaks, and fill
in valleys. The lowest, average, and highest altitudes are
found. Lower and upper limits are then computed from these using
the crush value; crush is used as a fraction of the distance from
the average to the lowest and highest altitudes. Any points
which exceed the limits will be clipped, by setting them equal to
the limits. The crush level must be between 0.0 and 1.0. The
default is 1.0 which leaves peaks and valleys unchanged. Typical
crush levels will be very small; 0.01 works well.
- 3 - Formatted: June 9, 2026
fractile(1) fractile(1)
The flood computation is performed before the crush computation,
so crushing has no effect on flooded points.
-e emphasis
The emphasis factor exagurates slopes, so the texture looks more
rugged. This has no effect when used with -ih, since -ih causes
colors to be chosen based on altitude instead of slope. The
default value is 10.0, and values from 5.0 to 20.0 are typical.
As a special case, the value 0 causes slopes to be computed using
a different algorithm which doesn't use the emphasis factor; it
chooses its own emphasis to make good use of the entire palette.
-w watercolor
This is the name of the color to use for flooded pixels. The
default is "darkblue."
-l lightcolor
This is the name of the "light" color, which is used for pixels
which have Northwest exposure or have the lowest altitude
(depending on the -i option). The default is "lightbrown."
-d darkcolor
This is the name of the "dark" color, which is used for pixels
which have Southeast exposure or have the highest altitude. The
default is "darkbrown." If the color table interpolates more than
2 colors, then "light" and "dark" colors are used as the
extremes, and the intervening entries are interpolated between
those two.
-m macro
Scan through a file named "fractile.mac" or "~/.fractile" for a
line which begins with the given macro name. If found, then
parse the remainder of that line as command-line arguments. As a
special case, if the name "random" is given, then fractile will
randomly choose a macro.
NOTE: Arguments are parsed from left to right. The means that
any arguments placed to the left of a -mmacro flag will be
treated as defaults which the macro may alter. Any arguments
placed to the right of a -mmacro flag will override the values
set in the macro. For example, "fractile -mwall -dpalegreen"
will generate a greenish wall image.
-M macro
Display the meaning of the given macro name, and then exit. When
you want to modify a macro, this can help you get some idea of
what parameters might be interesting to change.
- 4 - Formatted: June 9, 2026
fractile(1) fractile(1)
COLORS
The -l, -d, and -w options all allow you to select a color. The color
name can be any combination of the following: black, white, light,
pale, dull, dark, red, green, blue, yellow, brown, orange, gray, grey,
magenta, cyan, random, and same.
If you specify more than one color name, such as "bluegreen" or
"darkgray," then the colors are blended; i.e., their Red-Green-Blue
components are averaged.
The "random" color chooses random values for the Red-Green-Blue
components. The "same" color is identical to the previous random
color; this allows you do to things like "-llightrandom -ddarksame".
The -p option allows you to specify the palette size, and how many
intermediate colors are to be interpolated between the light and dark
colors. The default palette size is four colors. The default
interpolation uses the same number of colors, which causes smooth
color variations.
It is possible to use fewer interpolated colors in a larger palette.
This will cause the same few colors to appear in multiple palette
slots. For example, if the light color is white and the dark color is
black, then -p3,5 will cause the palette to contain white, gray,
black, gray, and white. This trick can be combined with the -ih flag
to produce an interesting topology map effect.
After generating the image, fractile reduces the palette to use as few
colors as possible. This allows the image to be compressed better,
reducing transmission time. It is also desirable when the image will
be used as the "wallpaper" image on an X terminal. In the example
above, the palette would be reduced to no more than 3 colors. If the
image didn't use white (which is quite possible, since white is used
only for the most extreme values in the example above) then it would
use only two colors.
MEMORY AND CPU USAGE
Internally, fractile allocates two arrays: a floating point array for
storing altitudes, and an array of bytes for storing pixel values.
These are both square arrays, 2^size elements on a side. Adding one
to the size (via the -s flag) will double the length of each side, and
so quadruple the amount of memory needed for those arrays and also the
CPU time needed to compute their values.
The default size is 7, so both arrays have a size of 128x128.
Consequently, the altitude array uses 64k of RAM and the pixel array
uses 16k.
Even if you have a lot of RAM, your compiler may not be able to
allocate larger arrays. You'll run into this problem if the size_t
- 5 - Formatted: June 9, 2026
fractile(1) fractile(1)
data type is only 16 bits long. (This is typical for 16-bit MS-DOS
compilers.) The default size, 7, should work but you can't increase
it.
NETSCAPE BACKGROUNDS
The images produced by fractile make excellent backdrops for Netscape
web pages. Just place the GIF file in the same directory as the HTML
document, and modify the HTML document's <body> tag to include a
"background" argument. For example, if the image is stored in a file
named "foo.gif" then your HTML document should be organized like
this...
<html>
<head>
<title>Sample HTML document with a background</title>
</head>
<body background="foo.gif">
... Other stuff goes here...
</body>
</html>
Because the lettering that you place on top of the background will be
black, the background itself should use light colors. I suggest you
try "-lwhite -dlightbrown" for starters.
Netscape dithers the background image to match the Netscape's own
color palette. This has two consequences. The first is that you
shouldn't hesitate to increase the number of colors used in the
background, via the -p flag. The second is that you should probably
use the -r flag to disable fractile's dithering; when Netscape dithers
an image which is already dithered, the result looks rather grainy.
Avoid using large background images. The default size, 128x128, will
add about 5 seconds to the time required to display the page.
Increasing the image size to 256x256 will quadruple that.
X11 ROOT IMAGES
The images produced by fractile can be used as background images for
X-Windows. If compiled with -DSUPPORT_X11, fractile can be executed
without specifying an output file name; fractile will then generate an
image and load it as the terminal's root image.
Alternatively, you can generate a GIF file the usual way, and use some
other utility to load the image on the terminal's root window.
Although the standard xsetroot(1) command can't load a GIF image onto
the root window, you can use John Bradley's xv(1) program as follows:
xv -root -quit foo.gif
- 6 - Formatted: June 9, 2026
fractile(1) fractile(1)
If your X display uses pseudo-colors, then you should probably avoid
using too many colors in the background image. Otherwise you might
not have enough colors left for your real applications. The default
of 4 colors (plus a fifth for water) is reasonable.
WALLPAPER FOR MICROSOFT WINDOWS
To use a fractile image as the wallpaper for Microsoft Windows, you
should direct fractile to output a Microsoft BMP file, and then move
that file into the Windows directory (usually C:\WINDOWS), and then
use the Control Panel utility's Desktop dialog window to select the
new image file.
To make fractile output a BMP file instead of a GIF file, just give a
filename that ends with ".BMP".
fractile default.bmp
fractile -lgreen greenmtn.bmp
fractile -ih -r -p2,10 topo.bmp
...
As always, you should try to use as few colors as possible. Most
Windows computers can only display a total of 256 colors, so if you
use a lot of colors in your wallpaper, your applications may look
funny.
NOTE: GIF files are usually much smaller than the equivelent BMP
files. GIFs are also more widely supported. Because of these facts,
you should probably use BMPs only for Windows wallpaper, and use GIFs
for everything else.
EXAMPLES
The following examples show how fractile can be invoked to produce
various effects. Because a random number generator is used when
producing the images, using the exact same command line repeatedly
will generate somewhat different results each time, so the
descriptions of the resulting image can't be exact.
For simplicity, these examples use the default size of 128x128 pixels.
You can easily change the size of any of these images by specifying a
-s value, or (for some of the more complex examples below) -s with
multiple values.
Elvis is distributed with a "fractile.mac" file which contains all of
these examples, so you could, for example, generate the "tendril"
example via the command "fractile -mtendril tendril". The list below
shows how to generate the examples without using the macros.
fractile default
This generates the default texture style, into a file named
- 7 - Formatted: June 9, 2026
fractile(1) fractile(1)
"default.gif". The default texture looks like an aerial view of
desert mountains.
fractile -lgreen greenmtn
This looks like an aerial view of green mountains, instead of
brown ones.
fractile -r -e13.0 nodither
This generates the default style of mountains, but without the
dithering. The decision of whether to use dithering or not is
often a matter of personal preference. Non-dithered images such
as this one are likely to compress somewhat better than dithered
ones.
The -e13.0 flag increases the slope emphasis; without it, there
would be very few pixels with a steep enough slope to make them
use the lightest and darkest colors.
fractile -r -p2 bitmap
This generates an image using only two colors.
fractile -r -e13.0 -lwhite -dlightbrown palemtn
This generates a pale image with no dithering, which should work
well as a background image for Netscape.
fractile -f0.4 shore
This creates an image with both land and water. Higher values
for the -f flag will generally increase the amount of water in
the image, but of course since the scene is randomly generated
there will be exceptions.
fractile -f0.3 -wwhite -ise snowcap
This example uses -ise to reverse the illumination, so that
valleys are illuminated as though they were peaks. The -f0.3 and
-wwhite flags make those "peaks" have snowcaps.
fractile -p3 -s7,5,5 -c0.2 -r -e13 chunky
Here we use -s7,5,5 to limit the details, so the resulting image
is rather chunky. The other options just make the image look a
little cleaner.
fractile -ih -r -p2,10 topo
This generates something that resembles a topological map, with
- 8 - Formatted: June 9, 2026
fractile(1) fractile(1)
bands of color representing the altitude at that point. Note
that without the -r flag, fractile would use dithering to
approximate smooth color changes, so we wouldn't get the color
banding effect. The -p2,10 causes it to create a 10-element
palette which is filled with multiple instances of the same 2
colors, to exagurate the banding effect.
fractile -ih -r -lgreen camo
This does the topological map thing, but with colors that make it
look like army camoflage. We don't need to do anything weird
with the palette to make this look good.
fractile -lwhite -dblue -ih -r -p20 cloud
This example looks like clouds. Note that the number of colors
has been increased quite a bit; this improves the realism of the
clouds. This example makes a good Netscape background image,
because the image will be light, have low contrast, and doesn't
use dithering.
fractile -r -p3 -c0.03 blob
This example makes flat blobs. Flat areas are drawn using a
color halfway between the light and dark colors; the -p3 flag is
intended to ensure that there is in fact an allocated color
halfway between them; the default -p4 would force it to choose
between two colors. The North and West edges of each blob will
be drawn in the light color, and the South and East edges will be
drawn in the dark color.
fractile -r -p3 -c0.03 -s7,3 smooth
This is exactly like the "blob" example, above, except that here
we add -s7,3 which prevents noise from being added after the
third stage of refinement of the altitude map. This eliminates a
lot of the detail from the image, so the blobs have much smoother
outlines.
fractile -f0.5 -wblack -lwhite -dwhite cow
This generates mottled black & white blobs, resembling cow skin.
Note how we made both the light and dark colors be the same
color, so that the "land" area will be featureless white.
fractile -s5,7 -c0.1 -lwhite -dlightbrown -r -e13 wall
The image that results from this command line looks a lot like
the wall of my apartment. This works well as a Netscape
background image.
- 9 - Formatted: June 9, 2026
fractile(1) fractile(1)
fractile -p2,3 -r -c0.2 -s7,3,4 -lgrayyellow -ddarkred -f0.4 tendril
This is similar to the "blob" example, except that here we use -
p2,3 to make the all edges use the "light" color. The larger
crush factor, -c0.2, causes the edges to be wider. Limiting the
refinement steps which are subjected to noise via -s7,3,4 has the
effect of reducing the convolutions within the edges, so the
edges will be a solid color. The -f0.4 flag causes the valleys
to be flooded instead of crushed. The combined result of all
this is a bunch of red and blue blobs, with yellow edges all
around them. Within the yellow edges, any valley floors or
ridges are also colored red, so there will be tendrils connecting
the blobs.
fractile -ih -p8,55 -dblack -llightrandom arc
This is a lot like the "topo" example, but here we use colors
which result in a picture which resembles an electric arc.
fractile -p16,160 -s7,2 pucker
This is an odd one. Typically it looks like pieces of cloth that
pucker down at edges, but it varies a lot. Also, try using -s7,1
(instead of -s7,2) for a simpler design, or -s7,3 for more
complexity.
fractile -p4,23 -s7,4,4 -lwhite -dpale marble
This is intended to look like polished marble. it is very
similar to the "pucker" example above; we just changed the colors
and allowed more detailed variations in altitude.
fractile -p16,151 -s7,3,3 -dwhite -c0.15 bones
This is another variation of the "pucker" example. Here we use a
crush factor to carve big holes in the pattern, and use colors
which resemble bone. I'm not sure that the pattern itself looks
like bones, but I couldn't think of a better name for it.
fractile -p16,151 -s7,3,3 -dwhite -c0.15 -ine12 balloon
This is almost exactly like the "bones" example. The only
difference is the addition of the -ine12 flag, which changes the
way each pixel's slope is computed. The result looks a bit like
balloons.
fractile -p5,100 -s7,3,3 -ih magnet
This is another topology map, but with more colors. The "-
s7,3,3" argument limits the detail, so the topology bands tend to
be smooth curves.
- 10 - Formatted: June 9, 2026
fractile(1) fractile(1)
fractile -s4,7 -c0.2 -r -f0.3 -p2 -wrandom -ddullsame -in lichen
This looks nice. It doesn't introduce any new tricks.
fractile -lred -dred -tcw -ih -p20,60 -s7,5 tiedye
This demonstrates the use of the -tcw flag. It also shows that
when the light and dark colors are both of the same hue, the
color interpolation path will wrap completely around the color
wheel, so you can see the whole spectrum.
ENVIRONMENT VARIABLES
DISPLAY
If fractile was compiled with -DSUPPORT_X11, and no output file
name is supplied on the command line, then elvis uses the
$DISPLAY environment variable to locate the X server whose root
window is to be changed.
FILES
fractile.mac or ~/.fractile
These files contain macros. On each line, the first word is
taken to be the name of a macro, and the remainder of the line is
parsed as command-line options when that macro is invoked via the
-mmacro flag.
- Supplying "-" as the name of the desired output file causes
fractile to write the GIF image data to stdout. There is no way
to write BMP image data to stdout.
*.bmp
Supplying any *.BMP file name as the name of the desired output
file causes fractile to write its data in Microsoft's BMP format.
*.gif or *
Any other other output file name causes fractile to write GIF
data out to the named file. If the file name has no extension,
then ".gif" is appended automatically.
SEE ALSO
crystile(1), xloadimage(1), xsetroot(1), xv(1), netscape(1)
COPYRIGHT
This program was placed in the public domain by its primary author,
Steve Kirkendall. You may copy it freely.
AUTHOR
Steve Kirkendall (kirkenda@cs.pdx.edu) wrote the image generation
code, the X-windows code, the BMP output code, and the documentation.
- 11 - Formatted: June 9, 2026
fractile(1) fractile(1)
The GIF output code was written primarily by David Rowley
(mgardi@watdscu.waterloo.edu).
- 12 - Formatted: June 9, 2026