An image-to-vector art generator that converts photographs into artistic collages composed of geometric shapes using a greedy optimization algorithm. The output is scalable SVG artwork.
This project is a derivative work based on primitive.js by Ondřej Žára.
The original primitive.js project pioneered the technique of reproducing images using geometric primitives with a genetic/optimization algorithm. Sketchbeast builds upon this foundation with modifications and enhancements.
MIT License
Original work Copyright (c) Ondřej Žára Modified work Copyright (c) Ross Turk
yarn run build
# or
make
# or
rollup -cNo dev server is configured. Simply open public/index.html in your browser, or use any static server:
python -m http.server 8000Sketchbeast uses a greedy optimization algorithm to iteratively add geometric shapes to a blank canvas, each time selecting the shape that most improves the visual similarity to the target image.
- Generate N random candidate shapes
- For each shape, compute the optimal color that minimizes difference from target
- Select the best shape
- Mutate the winning shape to refine it further
- Add shape to the SVG and repeat
Shape types include: Triangle, Rectangle, Rotated Rectangle, Ellipse, Quadrilateral, Line, Bent Line, Squiggle, and Scribble.
- Open
public/index.htmlin a browser - Upload an image
- Select the number of shapes and shape type
- Click the button to generate SVG artwork
- Download the resulting SVG file
Ross Turk ross@rossturk.com sketchbeast@basementexperiment.com