rh12503 / triangula-cli

MIT License
20 stars 7 forks source link
triangula

Triangula CLI

A CLI app which uses Triangula to generate triangulated images. For a simpler interface consider using the GUI.

Explanation of the algorithm

Running the algorithm saves a .json file every specified number of repetitions. This file contains data with the best set of the points from the algorithm. This file can then be rendered to a PNG or SVG.

Running

Run the algorithm using the command:

triangula run -img <path/to/your/image> -out <path/to/save/file>

For almost all cases, only changing the number of points and the shape type and leaving all other options with their default values will generate an optimal result.

To change the shape type use the flag:

-shape [triangles|polygons]

For a list of available options, run:

triangula run -help

Rendering

There are 2 image formats which the .json file can be rendered to: SVG and PNG. PNG is currently the only format that supports effects.

To change the shape type use the flag:

-shape [triangles|polygons]

SVG

Renders the .json file to a SVG.

Usage:

triangula render -in path/to/json -out path/to/save/svg

Options:

triangula render -help

PNG

Renders a .json file generated by the algorithm to a PNG. There are also multiple effects that can be applied to the output.

Usage:

triangula render -in path/to/json -out path/to/save/svg -img <path/to/your/image>

To add an effect, add the flag:

-effect [none|gradient|split]

Options:

triangula render -i . -o . -img . png -help