An open API service indexing awesome lists of open source software.

https://github.com/spejamchr/string_art

Transform an image into string art
https://github.com/spejamchr/string_art

art string-art

Last synced: 8 months ago
JSON representation

Transform an image into string art

Awesome Lists containing this project

README

          


String art rendering of an elephant

# string_art

> Transform an image into string art

## Installation

```bash
git clone https://github.com/spejamchr/string_art
cd string_art
cargo build --release
```

The binary will be at `./target/release/string_art`.

## Usage

```bash
string_art --input-filepath --output-filepath [FLAGS] [OPTIONS]
```

Use `--help` or `-h` to see the full usage.

## Examples

### Grayscale: White String on Black Background


Reference photo of red yarn on skein
String art rendering in white string on a black background of yarn on skein

```bash
string_art \
--input-filepath ./examples/fiber.jpg \
--output-filepath ./examples/fiber-string-wob.jpg \
--data-filepath ./examples/fiber-string-wob.json \
--pin-arrangement perimeter \
--pin-count 300 \
--step-size 0.5 \
--string-alpha 0.1 \
--max-strings 2300 \
--verbose --verbose
```

### Splash of Color: White & Red String on Black Background

This also uses the `--gif-filepath` options to create a GIF of the creation process.


Reference photo of red yarn on skein
String art rendering in red & white string on a black background of yarn on skein
Animation of string art construction

```bash
string_art \
--input-filepath ./examples/fiber.jpg \
--output-filepath ./examples/fiber-string-color.jpg \
--data-filepath ./examples/fiber-string-color.json \
--gif-filepath ./examples/fiber-string-color.gif \
--pin-arrangement circle \
--pin-count 300 \
--step-size 0.5 \
--string-alpha 0.1 \
--foreground-color '#FFFFFF' \
--foreground-color '#FF0000' \
--max-strings 2600 \
--verbose --verbose
```

### The Elephant: Auto-pick the colors

```bash
string_art \
--input-filepath ./examples/elephant.jpg \
--output-filepath ./examples/elephant-string.jpg \
--data-filepath ./examples/elephant.json \
--pin-arrangement circle \
--pin-count 400 \
--step-size 0.5 \
--string-alpha 0.1 \
-u 3 \
--verbose --verbose
```