Skip to content

Commit 0e16a63

Browse files
committed
Added potrace, convert png to svg
1 parent 383a626 commit 0e16a63

File tree

12 files changed

+2555
-0
lines changed

12 files changed

+2555
-0
lines changed

potrace/.babelrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"presets": [
3+
[
4+
"@babel/preset-env",
5+
{
6+
"targets": {
7+
"node": "current"
8+
}
9+
}
10+
]
11+
],
12+
"plugins": ["@babel/plugin-transform-async-to-generator"]
13+
}
14+

potrace/.gitignore

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (http://nodejs.org/api/addons.html)
33+
build/Release
34+
35+
# Dependency directories
36+
node_modules/
37+
jspm_packages/
38+
39+
# Typescript v1 declaration files
40+
typings/
41+
42+
# Optional npm cache directory
43+
.npm
44+
45+
# Optional eslint cache
46+
.eslintcache
47+
48+
# Optional REPL history
49+
.node_repl_history
50+
51+
# Output of 'npm pack'
52+
*.tgz
53+
54+
# dotenv environment variables file
55+
.env
56+
57+
# gatsby files
58+
.cache/
59+
public
60+
61+
# Mac files
62+
.DS_Store
63+
64+
# Yarn
65+
yarn-error.log
66+
.pnp/
67+
.pnp.js
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
lib

potrace/README.md

Whitespace-only changes.

potrace/headset.png

81.7 KB
Loading

potrace/headset.png.svg

Lines changed: 3 additions & 0 deletions
Loading
1.86 KB
Loading
Lines changed: 3 additions & 0 deletions
Loading

potrace/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "potrace",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"license": "MIT",
6+
"scripts": {
7+
"build": "./node_modules/.bin/babel --version && ./node_modules/.bin/babel src -d lib",
8+
"start": "node lib/index.js"
9+
},
10+
"devDependencies": {
11+
"@babel/cli": "^7.7.7",
12+
"@babel/core": "^7.7.7",
13+
"@babel/plugin-transform-async-to-generator": "^7.7.4",
14+
"@babel/preset-env": "^7.7.7"
15+
},
16+
"dependencies": {
17+
"potrace": "^2.1.2"
18+
}
19+
}

potrace/src/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import potrace from 'potrace'
2+
import fs from 'fs'
3+
4+
const fname = process.argv[2]
5+
6+
const primary = '#790000'
7+
const secondary = '#ce1720'
8+
9+
const params = {
10+
color: secondary
11+
}
12+
13+
potrace.trace(fname, function(err, svg) {
14+
if (err) throw err
15+
fs.writeFileSync(`${fname}.svg`, svg)
16+
})

potrace/test.png

81.5 KB
Loading

0 commit comments

Comments
 (0)