A simple utility for generating random abstract images (using mazes) for use as desktop wallpaper.
This is a utility (cough toy cough) for generating random images suitable for desktop backgrounds. These images are created by generating large random mazes and coloring them using Dijkstra's algorithm.
(Get it? A-MAZE-ing? I so kill me.)
Here are a few sample images to get you hungry for more...
The only dependency is libpng, which most systems probably have preinstalled. If yours complains when you try to build this, then yeah, you'll want to take care of that.
Assuming your dev environment is set up, the following ought to work:
$ make
Yup, just that. This will build a maze
executable in the current
directory.
Running without any arguments will generate a 640x480 image, suitable for previewing. It will use a random color scheme:
$ ./maze
You can customize the output by passing any of the following arguments:
maze s12345678
-- uses the given number to seed the random numbermaze w500
-- sets the width of the image to 500 pixelsmaze h500
-- sets the height of the image to 500 pixelsmaze q
-- quiet mode (don't write info to the console)maze c112233ff
-- adds the given color to the color scheme (the colormaze p-
-- does not draw the longest path.maze p112233ff
-- draws the longest path through the maze in themaze ga
-- use the built-in "autumn" color schememaze g10
-- generate a random color scheme consisting of 10 colorsmaze obackground.png
-- write the maze to the file background.png
maze agl
-- generate a maze using the "growing tree" algorithm,a*
-- choose algorithm randomly (the default)agl
--- "choose last" growing treeagw
--- weighted growing treeab
--- binary tree algorithmaa
--- Aldous-Broder algorithmars
--- recursive-subdivision algorithmmaze b0
-- sets the blur radius to 0 (disabling smoothing)maze b1
-- sets the blur radius to 1, making each pixel effectively 3 pixels wide (the pixel itself, and extending radius
pixels on each side). The extra pixels are blurred, making the image softer. Larger values for the blur radius will take (possibly MUCH) longer to draw.For example:
$ ./maze w1366 h768 g10
The above generates a 1366x768 maze and a color scheme (consisting of
ten colors). The result is then saved to maze.png
.
If you like this, you might also enjoy my book, "Mazes for Programmers":
https://pragprog.com/book/jbmaze/mazes-for-programmers
Information about twelve different maze generation algorithms, lots of maze-related projects, as well as a demonstration of how to use Dijkstra's algorithm to achieve the kinds of color effects that this project uses.
Jamis Buck ([email protected])
Creative Commons Attribution 4.0 International License
This work is licensed under a Creative Commons Attribution 4.0 International License.