How to reduce complexity of scanning svg file
Hello all.
I am using Inkscape to vectorise images - i.e. set up path information - that I can then parse the resulting .svg file into an intermediate program that when run generates the equivalent PDF drawing commands. This was nice and easy with version 0.46, but I have a windows XP configuration where the Inkscape floating toolbars don't work properly on that version and upgraded to version 0.48 where they now work. A new problem is now the path information (after working on the path) is now not just M,L,C,z commands, but also m,l,c commands, and command omission on repetition. (The M,L,C commands are great because translating them is relatively simple.)
I have attempted to correctly interpret the relative coordinates of the m,l,c commands, but I don't seem to get the curves right.
The command omission on repetition I may have to rewrite my parser, or try understand the whole thing again (No it wasn't BNF'd or Yacc'd).
I have a few options in order of preference:
1) Find the switch in Inkscape that makes it use the original M,L,C path commands.
2) Export the path(s) from inside Inkscape to something similar.
3) Fix my parser, which will take a while and may break again in future versions.
4) Find a nifty utility that helps with the svg parsing.
Can anyone can help or advise with the above options or suggest a better alternative?
Thanks In Advance
This email is subject to our disclaimer which can be found by visiting our website on http://www.elcb.co.za/UI/Contents.aspx?ID=28
On 2010-09-30 18:15, Stephen Dickason wrote:
...
- Find the switch in Inkscape that makes it use the original M,L,C path
commands.
There are two actually. In the Inkscape preferences go to the SVG output "tab", uncheck "allow relative coordinates" to prevent it from using m,l,c, check "force repeat commands" to make sure it outputs the command for each segment.
Export the path(s) from inside Inkscape to something similar.
Fix my parser, which will take a while and may break again in future
versions.
- Find a nifty utility that helps with the svg parsing.
lib2geom contains an excellent parser.
participants (2)
-
Jasper van de Gronde
-
Stephen Dickason