Random Art Generator is a command-line application to produce generative art.
When passed a target image, it will start painting elements on a blank canvas, essentially creating new images at random. Resulting images that are mathematically closer to the target image are kept, and used as a new canvas; results that aren't get discarded. This repeats until the desired number of attempts or generations is achieved.
Technically known as hill climbing, this process allows the creation of new images that progressively converge into the target image, with a style all its own depending on the chosen painting algorithm and its arguments.
This application is written in Rust, and downloadable binaries are currently available for macOS, Linux, and Windows. A webasm target - so it can be used as a JavaScript library - is planned for later.
Check the releases page to download the latest stable executables. Each package contains a single command-line executable ("rag") that can be used.
Alternatively, check the beta build actions, click any of the builds, and download the executable file built for your system. New beta builds are made on every merge to the dev
branch.
Basic example with general parameters:
rag target.jpg [--input input.jpg] [--output output.png] [--max-tries 50] --generations 10 [--background-color ff0022] [--scale 2.0] [--painter rects|circles|strokes] [--painter-alpha 0.1-0.2 1.0]
Circles painter example with specific parameters:
rag target.jpg --generations 10 --painter circles [--painter-alpha 0.1-0.2 1.0] [--painter-radius 1-100] [--painter-radius-bias -3]
Rects painter example with specific parameters:
rag target.jpg --generations 10 --painter rects [--painter-alpha 0.1-0.2 1.0] [--painter-width 1-100] [--painter-width-bias -3] [--painter-height 1-100] [--painter-height-bias -3]
Command line parameters and flags are still being added. See arguments for current documentation, or run rag --help
.
More in-depth explanations will be available soon.
Check out the dev
branch. Once Rust is installed, the code can be compiled and ran by Cargo with cargo run -- (other parameters)
. For example:
cargo run -- target.jpg [--input input.jpg] [--output output.png] [--max-tries 50] --generations 10 [--background-color ff0022] [--scale 2.0] [--painter rects|circles|strokes] [--painter-alpha 0.1-0.2 1.0]
Non-exhaustive unit tests also exist.
cargo test
A self-compiled release binary can be created with Cargo as well:
cargo build --release
MIT.