I want to convert a bitmap(.bmp .png etc) to a svg file in my C++ program. After searching online, I found inkscape can convert my bmp file to svg file. I downloaded the software and tried it. It worked. However, I don't know how to use it in my C++ program. Is it possible to implement inkscape in a C++ program? Or is there other tools to do the job?
btw, i also tried potrace but it will convert my bmp file to a black and white one. That's not what i want...
hello everyone!
I want to convert a bitmap(.bmp .png etc) to a svg file in my C++ program. After searching online, I found inkscape can convert my bmp file to svg file. I downloaded the software and tried it. It worked. However, I don't know how to use it in my C++ program. Is it possible to implement inkscape in a C++ program? Or is there other tools to do the job?
btw, i also tried potrace but it will convert my bmp file to a black and white one. That's not what i want...
I am using windows 10 and VS 2015.
https://inkscape.org/doc/tutorials/tracing/tutorial-tracing.html
Inkscape uses potrace - http://potrace.sourceforge.net/
@inklinea thank you for replying.
I tried potrace, but it seems that potrace is converting my grayscale bitmap to a white and black one, maybe i was using it wrong.
I want my svg looks just like the bitmap. I open a bmp file in inkscape and save it as a svg file, the file seems good for me
Potrace converts a bitmap to vector data.
If the bitmap looks exactly the same then it sounds like you are just embedding a bitmap into the svg.
Embedded bitmaps are encoded in base64.
I have attached an svg with with avatar embedded as a bitmap.
Edit the code and you will see
xlink:href="data:image/png;base64,
Followed by an image stream.
That is bitmap data *not* vector data.
If you just want to wrap a bitmap in an svg, perhaps search for C++ encode base64 image.
@inklinea Thank you so much!
I checked the svg file yesterday,and it was just like what you said--a bitmap coded in base64 and embedded in the file.
I will figure out what's the actual requirements and find the right way to accomplish it~
Thank you!