• Stars
    star
    121
  • Rank 293,924 (Top 6 %)
  • Language
    JavaScript
  • Created almost 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Convert stroked SVG into the outlined version

Outline Stroke

Sometimes you need an svg image that have stroked attributes in its paths but outlined like after applying Outline Stroke in Adobe Illustrator or Convert to Outlines in SketchApp

Build Status

Install

yarn add svg-outline-stroke

Usage

Note to output quality: Consider that svg-outline-troke traces the outline version from a bitmap copy of the input so, bigger is the input, most accurate is the traced version (also with lot more path points). If the output quality is insufficient simply provide a larger scaled SVG into the tool (see width, height and viewBox attributes).

String input:

const outlineStroke = require('svg-outline-stroke')

const strokedSVG = `
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
  <line x1="32" y1="16" x2="32" y2="48" fill="none" stroke="#202020" stroke-miterlimit="10" stroke-width="2"/>
  <line x1="48" y1="32" x2="16" y2="32" fill="none" stroke="#202020" stroke-miterlimit="10" stroke-width="2"/>
</svg>`

outlineStroke(strokedSVG).then(outlined => {
  console.log(outlined)
})

Buffer input:

const fs = require('fs')
const outlineStroke = require('svg-outline-stroke')

fs.readFile('./source.svg', (err, data) => {
  if (err) throw err
  outlineStroke(data).then(outlined => {
    fs.writeFile('./dest.svg', outlined, err => {
      if (err) throw err
      console.log('yup, outlined!')
    })
  })
})

Params

The second argument accepts params to apply directly when re-tracing the image, like fill color of the path, background and so on. Take a look into potrace params

outlineStroke(strokedSVG, { color: '#bada55' }).then(outlined => {
  console.log(outlined, 'Outlined SVG with #bada55 `fill` color')
})

Related

micro-outline-stroke Microservice with a public endpoint

outline-stroke-cli CLI version

More Repositories

1

csshake

CSS classes to move your DOM!
SCSS
4,814
star
2

reactour

Tourist Guide into your React Components
TypeScript
3,787
star
3

svgson

Transform svg files to json notation
JavaScript
412
star
4

reshake

CSShake as a React Functional Component
TypeScript
267
star
5

svgsprit.es

Public endpoint to generate SVG Sprites using svg-spreact
JavaScript
153
star
6

draGGradients

A simple tool to generate and customize multiple css3 radial gradients.
JavaScript
138
star
7

coloreact

A tiny Color Picker for React
JavaScript
88
star
8

Pixelator

A really simple tool to generate one element css box-shadow pixel style.
JavaScript
61
star
9

path-that-svg

Path that SVG!
JavaScript
56
star
10

element-to-path

Transform SVG elements into path
JavaScript
46
star
11

outline-stroke-cli

Convert stroked SVG into the outlined version
JavaScript
32
star
12

svg-path-tools

Tools to manipulate svg path (d)
JavaScript
26
star
13

Sassisfaction

Awesome Sass Resources
JavaScript
21
star
14

scale-that-svg

Scale that SVG!
JavaScript
19
star
15

svg-spreact-cli

CLI version of svg-spreact
JavaScript
19
star
16

svg-spreact

Create svg sprites using svgson and react
JavaScript
16
star
17

svgson-next

Deprecated: use [email protected] instead
JavaScript
15
star
18

svgson-cli

CLI version of svgson
JavaScript
14
star
19

tablexcel

Convert Excel tables in HTML code
11
star
20

micro-outline-stroke

UI and endpoint for svg-outline-stroke
JavaScript
10
star
21

newbancomail

Useful style package to use in projects.
CSS
10
star
22

elrumordelaluz

My website
JavaScript
6
star
23

my-css-guidelines

My personal CSS coding guidelines
5
star
24

iterm-tab

Open Item2 tab programatically from NodeJS
JavaScript
4
star
25

ministarter

Starter configuration for fast static web projects
JavaScript
3
star
26

telegram-translate-bot

A Telegram Bot to Translate into Italian
JavaScript
3
star
27

next-with-apollo-custom-app

JavaScript
2
star
28

responsimage

JavaScript
2
star
29

expresstart

Simple Express server starting files
JavaScript
1
star
30

react-braintree-custom-dropin

JavaScript
1
star
31

css-props

W3C List of CSS properties, both proposed and standard
JavaScript
1
star
32

tryExec

Exec an npm script trying several times in case a condition doesn't meets
JavaScript
1
star
33

fsvg

fsvg 💤
JavaScript
1
star
34

vercel-test-sharp-svg-fonts

JavaScript
1
star