sl

svg-linearize

turn curved svg paths into paths with only line segments

Showing:

Popularity

Downloads/wk

3

GitHub Stars

26

Maintenance

Last Commit

7yrs ago

Contributors

0

Package

Dependencies

5

Size (min+gzip)

1.5KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

svg-linearize

turn curved svg paths into paths with only line segments

var linearize = require('svg-linearize');
var loadsvg = require('load-svg');

loadsvg('face.svg', function (err, svg) {
    var nsvg = linearize(svg, { tolerance: 3 });
    document.body.appendChild(nsvg);
});

methods

var linearize = require('svg-linearize')

var nsvg = linearize(svg, opts)

Create a new svg, nsvg from an existing svg element.

Any curved paths in svg will be converted to line segment paths.

Optionally specify:

  • opts.tolerance - tolerance to feed into simplify-geometry, higher values mean fewer points. Default: 3.
  • opts.segments - number of points to sample each path. Default: 100.

install

With npm do:

npm install svg-linearize

license

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100