Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NodeJs convert PNG to SVG?

i search a solution to convert a PNG or JPEG Image to a SVG Vectordrawing. I found a lot "Convert SVG to PNG" but nothing about converting a PNG to a SVG. Can someone help me pls?

like image 798
NullDevelopment Avatar asked Mar 29 '18 04:03

NullDevelopment


2 Answers

Based on original the Potrace there is an npm package called node-potrace to generate SVG silhouettes from bitmap images.

Potrace is a tool for tracing a bitmap, which means, transforming a bitmap into a smooth, scalable image. T

Demo: http://kilobtye.github.io/potrace/

demo

  

like image 64
Anibal Avatar answered Nov 02 '22 19:11

Anibal


I'm trying to collect different image tracing libraries into one single project, currently potrace, imagetracerjs and geometrize here: (WIP / very new project)

browser/node.js : API: https://www.npmjs.com/package/svg-png-converter

command line tool: https://www.npmjs.com/package/svg-png-converter-cli

user-friendly playground (WIP): https://cancerberosgx.github.io/demos/bitmap2vector-converter/

no so friendly playground (only potrace implementation) :https://cancerberosgx.github.io/demos/svg-png-converter/playground/#

For logo-drawing like images it works fine. For photos, it can replicate it almost exactly but the svg generated is too complex.

The library will optimize the resulting SVG using svgo which simplifies and decreases its size a lot.

If anybody knows about another JS image tracing library please comment.

like image 28
cancerbero Avatar answered Nov 02 '22 18:11

cancerbero