Skip to content

ndbaker1/string-bean

Repository files navigation

🧵 string-bean

A String Art Generation Library

  1. Upload an image
  2. Preview the greyscale conversion from source image
  3. View thread anchor sequence drawn onto canvas
  4. Play with input parameters to change output

Sample Output

drawn by me ◕_◕

string-bean-sample

⚡ Usage

📦 Cargo

You can pull the crate from git and I will maybe publish at some point

[dependencies]
string-bean = { git = 'https://github.com/ndbaker1/string-bean' }

The CLI has some good example usage:

let mut planner = string_bean::ThreadPlanner::new(
args.line_opacity,
&anchors,
args.anchor_gap_count,
args.penalty,
grid_raytrace,
width,
height,
&img.into_vec(),
);
let anchors = planner.get_moves(0, args.line_count).unwrap();

⌨️ CLI

Though minimal, the repo includes a CLI that you can install by running:

cargo install --git https://github.com/ndbaker1/string-bean

It currently supports:

  • generating thread art for a circular boundary inside an input image and outputing an SVG file

🤔 Motivation

A recent youtube video about string art, The Mathematics of String Art, showed up in my recommended and was pretty interesting so i decided to try implementing it in 🦀 Rust.

There are also very few well documented projects for computational string/thread-art, so i figured i would try to make one that was easily accessible and avoided using libraries to do heavy lifting magic