https://github.com/retorillo/pixelated-svg
Create SVG vector image from raster image with keeping pixelated visual.
https://github.com/retorillo/pixelated-svg
converter nodejs pixel-art png svg
Last synced: 22 days ago
JSON representation
Create SVG vector image from raster image with keeping pixelated visual.
- Host: GitHub
- URL: https://github.com/retorillo/pixelated-svg
- Owner: retorillo
- License: mit
- Created: 2017-05-11T16:09:16.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-05-11T16:31:48.000Z (almost 8 years ago)
- Last Synced: 2025-03-21T15:54:09.877Z (about 1 month ago)
- Topics: converter, nodejs, pixel-art, png, svg
- Language: JavaScript
- Size: 10.7 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pixelated-svg
[](https://travis-ci.org/retorillo/pixelated-svg)
[](https://coveralls.io/github/retorillo/pixelated-svg?branch=master)
[](https://gemnasium.com/github.com/retorillo/pixelated-svg)
[](https://www.npmjs.com/package/pixelated-svg)
[](https://opensource.org/licenses/MIT)Create SVG vector image from raster image with keeping pixeleated visual.
## Functions
### fromPng
Create SVG document from PNG file. Asynchronous function. Returns `Promise`.
See also [Options](#options).```javascript
const svg = require('pixelated-svg');
svg.fromPng('foobar.png').then(svg => {
console.log(svg);
// =`, `>`)For example,
```javascript
const selector = ['< 249', '>= 35', 156, '*'];
svg.fromPng('rgb.png', {
includeColors: [ selector ],
}).then(...);
```This can select colors that satisfy the next conditions:
- R < 249
- B >= 35
- G == 156
- A can be any value## CLI
Command line interface will be available when globally installed. (`npm install -g pixelated-svg`)
```bash
pixelated-svg raster.png --scale 100 > out.svg
```Command line options correspond with `fromPng` options:
- `--scale` or `-s`
- Corresponds with `scale`.
- `--include`, `-i`, `--exclude`, `-e` (Experimental)
- Correspond with `includeColors` and `excludeColors` options
- Syntax must be "exact" JSON Array format. (eg. `-i "[[171, 70, 66, 255]]"`).
- This inconvenient constraint will be change later.## License
MIT License
(C) 2017 Retorillo