GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Hvrnbi/p2sa: A Rust library and a CLI tool to transform your pictures into String Art 🧵 This is a Rust rewriting of a project i did for school.

BranchesTags
Open more actions menu

Latest commit

 

History

14 Commits
14 Commits

Folders and files

NameName
Last commit message
Last commit date
images
images
 
 
src
src
 
 
.gitignore
.gitignore
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

ps2a (Picture To String Art)

A Rust library and a CLI tool to transform your pictures into String Art 🧵 This is a Rust rewriting of a project i did for school (documentation in french 🥖).

Hero

CLI tool installation

The easiest way to install p2as is to use cargo with this command :

cargo install p2sa

You can also install p2sa with the files in the releases section.

  • On debian-based distros, you can download the .deb file and install p2sa with the command sudo dpkg --install p2sa_0.1.2_amd64.deb (replace 0.1.2 with the actual version).
  • On windows, you can just download the .exe and call it in the terminal rather than the command directly.

You can now use it in your terminal with this command :

p2sa your-src-image-path output-path output-width output-height nails-count

Demo

Demo video

Library usage

⚠️ This crate is not published yet, this guide is not working at the moment ⚠️

To use the library, you need to add it to your project using cargo with this command :

cargo add p2sa

You can now call the p2sa function :

use p2sa::p2sa;

fn main() {
    // p2sa(src_path: String, output_path: String, output_size: [u32; 2], nails_count: u32);
    p2sa("path/to/your/picture.png".to_string(), "path/to/your/result.png".to_string(), [1024, 1024], 400);
}

Features

  • SVG, BMP, GIF, ICO, JPEG, PNG, WebP, and more format supported
  • Custom output resolution supported
  • Custom number of nails supported

How it works

The nails are randomly placed on the edges of the shapes. The program starts on the first nail of the list, and simulates the reduction of the difference between the original image and the working image. It chooses the line that reduces the difference the most, and repeat this steps until the error increase 3 times in a row.

For more details, you can check the wiki page of my school project. It's in french but may be translated.

Usage advices

I recommend trying to set the output format to SVG, it produces cleaner images because it is vector-based. If the output lacks details, you may want to increase the nails count. It may take some time (a few minutes) if you try to obtain an image of more than 2000x2000 px and more than 600 nails. You can obtain nice results with smaller resolutions.

Thanks

This crate relies heavily on the rust crates image and edge-detection.

Support me

ko-fi liberapay

About

A Rust library and a CLI tool to transform your pictures into String Art 🧵 This is a Rust rewriting of a project i did for school.

crates.io/crates/p2sa

Topics

string-artstring-art-generator

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.