Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/loiccoyle/strandify
🎨 Easy peasy string art
https://github.com/loiccoyle/strandify
art generative-art string-art wasm
Last synced: about 2 months ago
JSON representation
🎨 Easy peasy string art
- Host: GitHub
- URL: https://github.com/loiccoyle/strandify
- Owner: loiccoyle
- License: mit
- Created: 2022-09-02T17:03:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-01T02:49:41.000Z (2 months ago)
- Last Synced: 2024-11-01T03:24:43.543Z (2 months ago)
- Topics: art, generative-art, string-art, wasm
- Language: Rust
- Homepage: https://loiccoyle.com/strandify/
- Size: 12.7 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A CLI utility to create string art.
Create your string art here
This repo contains two crates:
- `strandify` crate contains the string art library.
- `strandify-cli` crate provides the command line interface.And one `npm` package:
- `strandify-wasm` provides the wasm bindings and allows `strandify` to be used in the browser.
## 📦 Installation
## Command line
To use the `strandify` binary to generate string art, install the `strandify-cli` crate:
```sh
cargo install strandify-cli
```### 📋 Usage
Once installed, you can use the `strandify` binary.
Something like:
```sh
strandify input_img.png output_img.png
```If in doubt see the help:
```console
$ strandify -h
CLI utility to generate string artUsage: strandify [OPTIONS] [OUTPUT]
Arguments:
Input image or blueprint json file
[OUTPUT] Output file, either image format, svg or jsonOptions:
-i, --iterations
Number of iterations [default: 4000]
-t
Transparent background
-c, --yarn-color
Yarn color [default: "0 0 0"]
--project-to-yarn-color
Project image to yarn color
-S, --peg-shape
Peg distribution shape [default: circle] [possible values: circle, square, border]
-n, --peg-number
Number of pegs. Depending on the shape, can be slightly off [default: 288]
-m, --peg-margin
Margin between pegs and image edge [0, 1] [default: 0.05]
-j, --peg-jitter
Add jitter to the peg position
-s, --peg-skip-within
Don't connect pegs within pixel distance
-O, --yarn-opacity
Yarn opacity to use to render the image [0, 1] [default: 0.2]
-W, --yarn-width
Yarn width to use to render the image [default: 1]
-o, --line-opacity
Line opacity to use when computing the path, controls how much to lighten the pixels at each line pass, low values encourage more line overlap [0, 1] [default: 0.1]
-w, --line-width
Line width to use when computing the path [default: 2]
-b, --beam-width
Beam search width, a value of 1 results in a purely greedy algorithm [default: 1]
-e, --early-stop-threshold
If provided, early stop pathing when consecutive path losses are greater than threshold
-E, --early-stop-count
Number of consecutive iterations with path losses above threshold to allow [default: 100]
--output-scale
Output scale [default: 1]
--save-pegs
Write pegs to file
--load-pegs
Read pegs from file
-v, --verbose...
Increase logging verbosity
-q, --quiet...
Decrease logging verbosity
-h, --help
Print help
```## Library
To use the library as a dependency in your project, add the `strandify` crate:
```sh
cargo add strandify
```See the [docs](https://docs.rs/strandify) for usage.
## Wasm
To use the `wasm` bindings in your project, add the `strandify-wasm` `npm` package:
```sh
npm add strandify-wasm
```I would recommend taking a look at the [demo page's source code](https://github.com/loiccoyle/strandify/tree/gh-pages) to see how to use it.
## 👓 Examples
See the [examples](https://github.com/loiccoyle/strandify/tree/main/examples) folder.