Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to simplify SVG code?

Tags:

svg

javafx

Is it possible to simplify / clean up svg code by replacing the use-tags with standard svg elements? Maybe an inkscape plugin? Haven't found anything...

Background: I'm converting some svgs to javafx graphics (.fxz) with javafx's production suite. And the tool doesn't understand the <use> element.

like image 786
räph Avatar asked Dec 01 '09 08:12

räph


1 Answers

Take a look at Scour - an SVG scrubber

Scour is an open-source Python script that aggressively cleans SVG files, removing a lot of 'cruft' that certain tools or authors embed into their documents. The goal of scour is to provide an identically rendered image (i.e. a scoured document should have no discernable visible differences from the original file).

They also have an extension for Inkscape as of v.48. To use it, go to "Save As.." and choose "Optimized .SVG. Be careful, and check your output, as I've found it can get too aggressive. Take these examples for instance, if they show up...

Good: Original SVG, only slightly mucked with.. Bad: After a harsh "Scouring"

They claim to have and an online tool that does the same tricks... but as of 6/2011 it was not working. Hope this helps you clean up those often SCARY looking SVG's. Sometimes I feel like I'm the only one that realizes what this format is capable of!

like image 150
Alex Gray Avatar answered Oct 05 '22 08:10

Alex Gray