Hacker News new | ask | show | jobs
by molf 4948 days ago
This is pretty cool. Compression ratios will probably vary a lot, but in a completely unscientific test just now a few SVG files saved with Illustrator were shrunk by 20-30%. The ratio was similar after gzip compression.

Speaking of gzip compression, the most obvious and effective way to reduce the size of SVG files on your website is to serve them with gzip compression. Be sure to configure your web server to do this before thinking of applying this tool.

I also see some opportunity for lossy compression. The precision of coordinates can often be reduced: 2 decimals is usually enough. Perhaps some paths can be simplified too?

1 comments

you can change the precision via config (3 digits by default) right now or via special command line param that will appear in the next minor version.

about lossy optimizations – there is an idea of curves simplifying with Visvalingam’s algorithm - https://github.com/svg/svgo/issues/9