flupke / pypotrace

Python bindings for potrace library
Other
165 stars 43 forks source link

How to convert path object to svg? #12

Closed rvk86 closed 7 years ago

rvk86 commented 7 years ago

Probably a noob question, but I'm wonding how I get from a traced bitmap (so the result of the .trace() method on the Bitmap object) to svg (xml) format? I can't find anything in the documentation about this.

Thanks in advance for the answer!

flupke commented 7 years ago

I don't know SVG but you can probably find lots of information on it online.

rvk86 commented 7 years ago

Thanks for your quick response. Sure, finding info about svg online is not the problem. Potrace however offers the --output flag to define an output file. I guess my question is how to get from the result of Bitmap.trace() to the output? Thanks

flupke commented 7 years ago

The idea behind pypotrace was to expose just enough of potrace's API to get vector data from a bitmap. What is done with the vectorized output is outside of the scope of pypotrace. Why not use the potrace binary directly to create your SVG?

rvk86 commented 7 years ago

Yeah, okay, makes sense. I've been successfully using potrace directly already, but doing that requires me to write to disk several times. I figured doing it all in memory would be more efficient. Thanks anyway. I'm going to dig into it!