Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi guys

my problem is to convert bitmap to SVG in c#. I found something like this http://docs.opencv.org/2.4.2/doc/tutorials/imgproc/shapedescriptors/find_contours/find_contours.html but this didn´t solve my problem. I need to convert for example a facewith white background from bitmap to svg. Are there any codes in c# which can help me?... I dont want to use XML. For beginning i would like to convert square or triangle or circ from bitmap to SVG.

THX for help :)
Posted

We aren't going to be able to give you an "out of the box" solution: this is not a trivial process in any way, shape or form.

The problem is that Bimap, JPG, PNG, etc. files are raster graphics: they store a fixed array of pixels in various shades of red, green and blue (or hue, lightness and shade - whatever) while SVG files are vector graphics - which means they store images as "draw line from (x1, y1) to (x2, y2)" and "draw an arc here" commands.
And the two are not compatible.

It is possible to do - the process is called "vectorisation" - but the results are unlikely to be perfect, and if you are talking about a natural world object (like a photo of a face) it's very, very unlikely to work without some considerable effort on your part.

Certainly, there is no simple "plug in code" that I know of that will let you do that: but there is this approach which looks interesting: http://asserttrue.blogspot.co.uk/2010/01/fast-conversion-of-bitmaps-to-svg.html#[^]

I don't think you are going to find this a simple task: be prepared to put some significant effort into this!
 
Share this answer
 
SVG being an xml-based format, if you do not want to use xml, you are going to have quite a hard time :)

The following post on SO could perhaps shed a light on your requirement:
SO: Convert Image (JPG,BMP,GIF) to SVG[^]
 
Share this answer
 
ok so now.. i need to trace that bitmap... and then vectorize it... and save as SVG... but i cant use freeware like inkscape... i need to make my own app.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900