开发者

Image/ByteArray to SVG conversion?

开发者 https://www.devze.com 2022-12-11 18:54 出处:网络
I am wondering if it is possible to开发者_JS百科 get a url to some image on google, say a square (jpg/png/gif), and process it into an SVG.Is this possible?

I am wondering if it is possible to开发者_JS百科 get a url to some image on google, say a square (jpg/png/gif), and process it into an SVG. Is this possible?

Right now I'm getting ByteArray data in Actionscript by making a URLRequest('image/on/google'), with dataFormat="binary". I don't think Actionscript could handle/do it, but maybe it could. I'm also good with Ruby, so perhaps is this possible with Ruby?

If so, any sample code/libraries to get started?

I guess another way to ask it is, how do I convert a Bitmap to a set of Vector Paths like Adobe Illustrator does?


There is no default support - You'll have to write your own raster-to-vector conversion algorithm, preferably at the server side as it can be CPU heavy. A quick search for raster to vector / jpg to svg revealed only tools and algorithms, not APIs.


You need to vectorise it, which is often called 'tracing'. Desktop illustrating programs like Adobe Illustrator can do this, by clicking around in the UI obviously.

There are free libraries and tools like potrace and Autotrace which do take (grayscale) bitmaps and generate SVG.

Commercial tools like Vector Magic can do colour images too.


Have a look at Sakri's bitmap to polygon code: http://www.sakri.net/blog/2009/06/12/an-approach-to-triangulating-polygons-with-holes/

0

精彩评论

暂无评论...
验证码 换一张
取 消