GithubHelp home page GithubHelp logo

vvcaw / svg2pts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from exrok/svg2pts

1.0 0.0 1.0 848 KB

Commandline utility to convert the paths in a svg to a list of points.

License: MIT License

Rust 100.00%

svg2pts's Introduction

svg2pts

Command line utility to convert the paths in a SVG to a list of points. All paths in the SVG are converted into a list of points with curve interpolation is controlled by command line arguments. Paths with no stroke nor fill are ignored. Output is a sequence of points, X Y\n

Installation

Using snaps:

snap install svg2pts

Using cargo:

cargo install svg2pts

OR with enabled text feature, requires harfbuzz,

cargo install svg2pts --features=text

This will make the svg2pts binary available in your cargo binary directory; usually ~/.cargo/bin.

Usage

svg2pts 0.1.5
Converts all paths in a svg to a list of points. Paths
with no stroke nor fill are ignored. Output is a sequence of points, `X Y\n`. 

USAGE:
    svg2pts [OPTIONS] [ <input> [<output>] ]

FLAGS:
    -h, --help       Prints help information

OPTIONS:
    -a, --accuracy <accuracy>    Set tolerance threshold for bezier curve approximation, 
                                 lower -> higher quality [default: min(<distance>/25.0,0.05)]
    -d, --distance <distance>    Set target distance between points, depends on DPI of SVG.
                                 If distance == 0.0 point distance not normalized.
                                 [default: 0.0]

ARGS:
    <input>     Input SVG file, stdin if not present
    <output>    Output file, stdout if not present"#

Changelog

  • v0.1.5
    • Fix: Commandline argument, output file bug.
    • Change: Lower tolerance threshold for improved default accuracy and scale threshold for small distances.
  • v0.1.4
    • Make text support an optional feature, making the harfbuzz dependency optional.
  • v0.1.3
    • Improved distance normalization: The points generated more accurately follow the paths in the SVG at a variety of distance parameters.
    • Hidden path removal: Paths which have no stroke nor fill value are ignored when generating points.
  • v0.1.2
    • Transformations now applied: Previously path transformations where ignored.

Examples

$ svg2pts -d 3.5 media/rust.svg
71.05 120.32
67.5572042727889 120.0955495422685
64.09895790373652 119.5565392910338
60.64071153468416 119.0175290397991
57.283778022261004 118.02707591462337
...

$ svg2pts -d 3.5 media/rust.svg | gnuplot -p -e 'plot "<cat"'
#graphs below

SVG converted to points with distance 1.5

SVG converted to points with distance 3.5

SVG converted to points without normalized distance

SVG converted without normalized distance and lower accuracy (simplified)

SVG converted to points then displayed on an oscilloscope

svg2pts -d 3.5 rust.svg | pts2wav > logo.wav

Rust logo svg converted to pts and display on oscilloscope.

You can get pts2wav here https://github.com/exrok/pts2wav

svg2pts's People

Contributors

exrok avatar vvcaw avatar

Stargazers

 avatar

Forkers

mohammed321

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.