Xaml/SVG Path Compressor

What do I use this for?

I have often found that importing vector graphics from an application such as Adobe Illustrator can lead to very long strings of path data. Whilst this is somewhat expected, it does tend to bloat a XAML/SVG file. This tool shortens the data whilst keeping a reasonable representation of what it originally represented.

How does it work?

By lowering the level of precision of each of the nodes in a path's vector data the string is shortened, sometimes dramatically. The end result may appear very similar to the original, at least at 100% zoom. In cases where this is acceptable, this tool can reduce path strings by over over 50%. If you have any XAML files with lots of path data in, and a small loss of path accuracy is acceptable then this may help reduce the size of your XAP files. The benefit ought to stack with obfuscation and standard encryption methods to a degree.

Visual Change (original on left, processed on right)
Map Path Comparison

Code Length Change (original on left, processed on right)

Path Text Comparison

How do I use it?

3 ways:
  • Use it online here.
  • Download a build and open the .aspx or .html file in a browser.
  • Download the source code and recycle. The juicy bit is the self-sufficient PathCompressor.cs class file, which is an easy to use static class. I believe other parts of the source code require the Silverlight toolkit (version 4, I think).

Ideas, Issues or Feedback?

Let me know. This is my first OS project, so be nice!

Last edited Sep 24, 2011 at 7:24 PM by AdamDavidHill, version 4


No comments yet.