crystile(1) crystile(1) NAME crystile - generate crystaline backgrown tile images SYNTAX crystile [-m macro] [-r] [-s [width,]height] [-i style] [-p colors[,palettesize]] [-t travel] [-g grain] [-c curl[,curl2]] [-n seeds] [-l light] [-d dark] [-w thawed] [-f freeze] [filename[.gif]] DESCRIPTION This program simulates the growth of crystals to generate an image. The simulation isn't very accurate, but it does produce some pretty pictures. 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 a wide variety of images. Initially, the image is filled with the "thawed" color. Then a few randomly chosen pixels are frozen, to serve as the seed crystals. Then the program goes into a loop, in which any thawed pixel which is adjacent to a frozen pixel becomes frozen itself. Each frozen pixel has an orienta- tion, and crystals are more likely to grown along their orientation axis. When a pixel freezes, its color is cho- sen based on the color of its seed crystal, or its orien- tation, or its age. When all pixels are frozen, then the image is complete. The image is then either loaded into the root window of your X terminal, or written out to a file. If it is writ- ten to a file, crystile will use Microsoft's BMP image file format if the file name ends with ".bmp", or Com- puserve's GIF format for any other name. If you give a name that doesn't have a file name extension, then crys- tile will add ".gif" onto the end of it. As a special case, if the name is just plain "-" then crystile will write the GIF image data to stdout instead of a file. OPTIONS -v Causes crystile to display its version number, and then exit. -r Normally crystile will use weighted random dither- ing 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. -s [width,]height This option allows you to specify the size of the 1 crystile(1) crystile(1) image to generate. This can be a rectangle of any size. If you don't specify a width, then it will be set equal to the height. The default size is 128x128 pixels. -i style This controls how a frozen pixel's color is chosen. The default is orient, which causes the color to be chosen pased on the orientation of the pixel's crystal; this often produces interesting 3D effects. Setting it to age causes the color to be derived from the time that the pixel took to freeze; this typically generates irregular rings or bands of each color. You can make the bands wider by appending a number to the word "age", e.g. -iage4. The final option is seed in which each pixel is given the same color as the seed pixel of its crystal; this results in irregularly shaped blobs of distinct colors. As a special case, -irandom will cause crystile to randomly choose one of orient, age, age4, or seed. -p colors[,palette] This controls the number of colors to use for frozen pixels. The colors are organized into a palette. By default, the palette size is chosen to be just large enough to store the dark color, all interven- ing colors to the light color, and then all inter- vening colors back to the dark color again. You can explicitly give a palette size, if you prefer a different arrangement. Either way, the palette size must not exceed 255. -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 crystile to travel in a straight line between the two col- ors. 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 exam- ple, 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 2 crystile(1) crystile(1) Additionally, you can use -trandom to have crystile randomly choose one of those three paths. -f freeze This deterimes what fraction of the image is to be frozen. It should be a number between 0.0 and 1.0. By default, it is 1.0 so the entire image is frozen. -n seeds This controls the number of seed crystals. The default is 10. Larger numbers tend to produce more complex images. -g grain This determines the probability that a crystal will grow along its orientation. It should be between 0.0, indicating that crystals should grow equally in all directions, and 1.0, indicating that crys- tals should grow along their orientation until they hit another crystal. The default is 0.5. -c curl[,curl2] This causes a crystal's orientation to twist as it grows. The default curl factor is 0, which pro- duces straight crystals. If you supply a single number between 1 and 128, such as -c1, then when the crystal grows along its orientation, it will tend to curl around to form a "C" shape. You can also supply two numbers, e.g. -c1,3, to make it curl by different amounts in the forward direction than in the reverse direction. The second number is permitted to be between -128 and 128; if you use a negative curl factor for the reverse direction, then it will tend to grow in an "S" shape, but it will also branch out, producing an interesting feather-like image. -w thawcolor This is the name of the color to use for pixels that never froze. The default is "darkdarkblue." -l lightcolor This is the name of the color that occurs at the "light" end of the spectrum. The default is "lightblue." -d darkcolor This is the name of the color at the "dark" end of the spectrum. The default is "darkblue." 3 crystile(1) crystile(1) -m macro Scan through a file named "crystile.mac" or "~/.crystile" for a line which begins with the given macro name. If found, then parse the remain- der of that line as command-line arguments. As a special case, if the name "random" is given, then crystile 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, "crystile -mknit -dpale- green" will generate a greenish knit 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. COLORS The -l, -d, and -w options all allow you to select a color. The color name can be any combination of the fol- lowing: 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 "blue- green" 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 number of colors is four. The default palette size is computed by subtracting one from the number of colors and doubling it; for 4 colors, the default palette size is 6. When the palette size is larger than the number of colors, crystile will cause the same few colors to appear in mul- tiple palette slots. The interpolation algorithm bounces between the light and dark colors. 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. 4 crystile(1) crystile(1) After generating the image, crystile 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. NETSCAPE BACKGROUNDS The images produced by crystile 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 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... Sample HTML document with a background ... Other stuff goes here... Because the lettering that you place on top of the back- ground will be black, the background itself should use light colors. I suggest you try "-lwhite -dlightblue" 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 crystile'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 crystile can be used as background images for X-Windows. If compiled with -DSUPPORT_X11, crystile can be executed without specifying an output file name; crystile will then generate an image and load it as the terminal's root image. 5 crystile(1) crystile(1) Alternatively, you can generate a GIF file the usual way, and use some other utility to load the image on the termi- nal's root window. Although the standard xsetroot(1) com- mand 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 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 crystile image as the wallpaper for Microsoft Windows, you should direct crystile to output a Microsoft BMP file, and then move that file into the Windows direc- tory (usually C:\WINDOWS), and then use the Control Panel utility's Desktop dialog window to select the new image file. To make crystile output a BMP file instead of a GIF file, just give a filename that ends with ".BMP". crystile -p6 -c3 -n3 quilt.bmp crystile -c5 -p6 -g.9 -n40 barnacle.bmp crystile -iage -p20,20 -g.8 -f0.95 wicker.bmp ... As usual, 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 equive- lent 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 crystile can be invoked to produce various effects. Because a random number genera- tor is used when producing the images, using the exact same command line repeatedly will generate somewhat dif- ferent results each time, so the descriptions of the resulting image can't be exact. Elvis is distributed with a "crystile.mac" file which con- tains all of these examples, so you could, for example, generate the "barnacle" example via the command "crystile -mbarnacle barnacle". The list below shows how to gener- ate the examples without using the macros. 6 crystile(1) crystile(1) crystile orient This is a simple example of the "orient" image style. You don't need an explicit -iorient flag because that's the default. crystile -iseed seed This is an example of the "seed" image style. Not that the colors are not dithered. A more suble difference is that the the seed colors are drawn equally from the whole palette, and those colors are independent of the orientation. crystile -iage age This is an example of the "age" image style. The nested bands of color are analogous to rings in a tree trunk; they mark the edges of the crystals at different points in their growth. crystile -iage4 age4 This is another example of the "age" image style. In this example we used an age multiplier of 4, to make the color bands thicker. crystile -iage -p2 moire Here we use just 2 colors, so the aging bands are very thin. crystile -iage3 -p2 moire3 Still 2 colors, but the age multiplier makes the bands 3 times as thick. crystile -iseed -llightrandom -ldarksame choose This shows one way to make random colors. crystile -tcw -p8 colors These colors aren't random; instead, 8 points were taken at equally-spaced intervals around the color wheel. crystile -tcw -p8 -c1 -g0.9 -f0.5 prism Here we add -c1 to make the crystals curl slightly, -g0.9 to make them much longer than they are wide, and -f0.5 so that only half of the image will be frozen. Curling is a result of changing the crys- tals' orientation as they grow; since we're choos- ing colors based on the orientation, the colors 7 crystile(1) crystile(1) will shift as the crystal grows, too. The result of this is chromatic arcs against a thawed (dark- darkblue) background. crystile -tcw -p8 -c1 -g0.9 -f0.5 -iage rainbow By adding -iage, we cause colors to be chosen by age instead of orientation. The "banding" effect shows up again. crystile -tcw -p8 -c1 -g0.9 -f0.5 -iseed stroke Here we're coloring by seed color, which never changes. Consequently, each arc is a single solid color. crystile -p6 -c3 -n3 quilt This is a subtle one. The -p6 gives us more col- ors, which is important because we're hoping to achieve a 3D shading effect. The -n3 flag causes crystile to start with just 3 seeds, instead of the usual 10. The -c3 causes those crystals to curl. As the crystals grow, they will quickly form rings, and then fill in around the rings. Since we're coloring by orientation, part of each ring (and the nearby filled-in pixels) will be light and part will be dark. The final result looks somewhat like puffy cones which have been stiched together. crystile -c5 -p6 -g.9 -n40 barnacle This resembles the "quilt" example, but is done on a much smaller scale. We increased the curl factor and the number of seeds. We also increased the grain factor (-g.9) to make each cone be more dis- tinct. crystile -p5,19 -c3 -n3 shave The major trick here is -p5,19, which causes the palette to be filled with colors in an unusual way. Instead of going from light to dark and back to light again, this example goes from light to dark to light to dark to light. This example would oth- erwise resemble the "quilt" example, but because the colors are assigned differently we get a very distinctive image. crystile -iage -p20,20 -g.8 -f0.95 wicker Here we use some long (-g.8) straight crystals that bump into each other at odd angles. Because they quickly bump into each other they stop growing at 8 crystile(1) crystile(1) their ends, and only grow from their sides. Because we're coloring by age, the pixels near the side of each crystal will be much darker than the pixels near the middle. Slight gaps will show between some crystals because of the -f0.96 flag. The ultimate result of all this looks somewhat like woven wicker. Note that we're using 20 colors! crystile -iage -p10,12 -s64 -n20 knit This is a smaller version of the "wicker" example, with more seeds (-n20) to make it more complex. It resembles knitting. crystile -iage -p20,20 -g.8 -c1 -n12 tangle This is a lot like the "wicker" example, except that the crystals curl because of the -c1 flag crystile -p6 -tccw -g.9 -n40 -iage jagged The -p6 and -tccw cause six colors to be chosen from across the spectrum. The -g.9 flag causes the crystals to grow into each other quickly, and means there are a lot of crystals so the image will look very complex. The -iage flag causes colors to be assigned by age. crystile -c1,-1 -g0.95 -n1 -iage feather This example uses a negative value for the reverse curl factor, producing a feathery image. crystile -c1,-5 -g0.95 -n1 -iage paisley This is exacly like the "feather" example above, except that here the reverse curl factor is -5 instead of -1, so the reverse curls tend to produce small circles instead of feathering. ENVIRONMENT VARIABLES HOME This is the ".crystile" macro file resides. DISPLAY If crystile 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 crystile.mac or ~/.crystile These files contain macros. On each line, the 9 crystile(1) crystile(1) 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 crystile 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 crystile to write its data in Microsoft's BMP format. *.gif or * Any other other output file name causes crystile to write GIF data out to the named file. If the file name has no extension, then ".gif" is appended automatically. SEE ALSO fractile(1), xloadimage(1), xsetroot(1), xv(1), netscape(1) COPYRIGHT This program was placed in the public domain by its pri- mary 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. The GIF output code was written primarily by David Rowley (mgardi@watdscu.waterloo.edu). 10