Minimal example of the Geometrize Haxe library, a Haxe library for converting images into shapes.
Install the dependencies:
haxelib install hxcpp
haxelib install format
haxelib install mcli
haxelib install Sure
Either open the project folder in VSCode, or run Haxe from the command line:
haxe GeometrizeHaxeExample.hxml
This demo works on the C++ target. Move the built binary to the sample images folder and start geometrizing some images. Pass command line options to specify the options the program should use for converting images into shapes.
# Create an image made of 400 circles
./Main.exe -i sliced_fruit.png -o sliced_fruit_out.png -t circle -s 400
Flag | Description | Default |
---|---|---|
i | The filepath to load the input image from | n/a |
o | The filepath to save the output image, JSON data or SVG | n/a |
t | The type of shape to use | One of: rectangle, rotated_rectangle, triangle, ellipse, rotated_ellipse, circle, line, quadratic_bezier, polyline |
s | Number of shapes to use in the output image | 250 |
c | The number of candidate shapes per shape added to the output image | 500 |
m | The maximum number of times to mutate each candidate shape | 100 |
a | The opacity (0-255) of each shape added to the output image | 128 |
- Got an idea or suggestion? Open an issue or send Sam a message on Twitter.