Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

String Art

An algorithm for generating and displaying string art from an arbitrary image. String art is a way of constructing an image using only overlapping stright lines between fixed points around a circle and was a style pioneered by the artist Petros Vrellis. As a small experimental project I've created a greedy algorithm which achieves this conversion and created a simple CLI to let people experiment with it and generate their own art! Below is an example of the string art generated from a portrait of the actress Audrey Hepburn.

Audrey Hepburn Example

Installation

  1. Clone this repository
  2. Install dependencies:
pip install -e .

This will install the convert_to_string command globally.

Usage

Basic Usage

convert_to_string img.jpg

This will:

  • Load img.jpg
  • Generate string art with default parameters
  • Save to output.png (in whatever directory you are in)

Specify Output File

convert_to_string portrait -o my_artwork.png

Custom Parameters

convert_to_string audrey.jpg -o output.png -s 400 -p 512 -d 40

Command Line Options

Option Short Default Description
img_path - (required) Input image name
--output -o output.png Output image path
--size -s 1000 Output image size in pixels (square)
--pegs -p 200 Number of pegs around the circle
--darkness -d 50 Line darkness/opacity (0-255)
--distance-weight - 1.0 Weight for distance in line selection
--darkness-weight - 1.0 Weight for darkness in line selection

Tips

String art works best when you are using it on images with certain properties, so to get the best outcomes try the code on images which...

  • Do not contain tiny details
  • Look good in greyscale
  • Have most of their detail focused around the centre of the image
  • Have low contrast

Help

View all options:

convert_to_string --help

About

A CLI tool for converting images to string art

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages