Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conversion of JPEG to SVG in Javascript

Tags:

javascript

svg

Can anyone help... how to convert Image to Vectors (SVG) through Javascript.......! Any help will be awesome....!

like image 916
Zain Avatar asked Oct 26 '10 10:10

Zain


3 Answers

This project supports both bitmap to SVG and SVG to bitmap (png/jpeg/gif/etc),offers flexible settings, different renderers, JavaScript API for node.js and browser, and Command line .

If configured correctly it generates good results and small svg size. If you just want to transform logos / drawings then no config is needed but if photographs / realistic paintings then some you need to play with the settings until satisfied with size / quality ratio.

https://www.npmjs.com/package/svg-png-converter

It has a playground although right now I'm working on a better one since more features has been added:

https://cancerberosgx.github.io/demos/svg-png-converter/playground/#

like image 152
cancerbero Avatar answered Nov 17 '22 20:11

cancerbero


Three options

Use Online convert's API

http://apiv2.online-convert.com/

Run your own node.js server and use Potrace or AutoTrace

https://www.npmjs.com/package/potrace used by Online convert https://www.npmjs.com/package/autotrace

Or use imagetracerjs client side.

https://github.com/jankovicsandras/imagetracerjs

like image 38
arpo Avatar answered Nov 17 '22 21:11

arpo


What you're asking isn't really possible. I mean, you could try to do it, but I doubt the results would be particularly satisfying.

SVG to JPEG is a one-way conversion; converting a raster image to a vector image is non-trivial, see this question.

like image 1
Williham Totland Avatar answered Nov 17 '22 22:11

Williham Totland