Phlox

A gem for creating generative gradient art. In brief, here's how it works:

  1. Three trees of mathematical expressions are randomly generated
  2. These expression trees are used to evaluate the (r, g, b) color of each (x, y) pair in the grid
  3. The color values for each spot in the grid are turned into pixels on an image It works surprisingly well, and an infinite amount of interesting images can be made.

Here are some examples of what phlox can generate: Gradient art Gradient art Gradient art Gradient art Gradient art Gradient art Gradient art Gradient art Gradient art Gradient art Gradient art See the art/ directory for more images.

Installation

Add this line to your application's Gemfile:

gem 'phlox'

And then execute:

$ bundle

Or install it yourself as:

$ gem install phlox

Usage

You can use the Phlox::gen_pic method to generate a gradient art image. All parameters to this method are optional and have default values.

gem 'phlox'

# generate a 255x255 gradient, scale it by 3, and write it to "out.png"
Phlox::gen_pic width: 255, height: 255, fpath: "out.png", scale: 3

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://gitlab.com/Bleu-Box/phlox.