Skip to content

Instantly share code, notes, and snippets.

@douglasmiranda
Last active April 12, 2024 14:35
Show Gist options
  • Save douglasmiranda/be203d129c55ad7793ccf06059ee1dd4 to your computer and use it in GitHub Desktop.
Save douglasmiranda/be203d129c55ad7793ccf06059ee1dd4 to your computer and use it in GitHub Desktop.
About SVG Optimizers

I was looking for a SVG Optimizer tool, cli tool preferably. SVG generated when converting from pdf to svg are kinda big.

More about PDF to SVG: https://gist.github.com/douglasmiranda/9c19f23c4570a7b7e02137791880ab43

SVGO - NodeJS

SVGO is awesome, you can get thin svg files from it. =]

It's a cli tool, but keep in mind it's a nodejs tool, so you have to install node, it doesn't have an official compiled binary. https://github.com/svg/svgo

There's an effort to create a compiled binary for SVGO, but it's not official and I don't know yet if they will ever support.

If you want to help with making this happen:

https://github.com/twardoch/svgop

NOTE: Another NodeJS it's the htmlclean they have a cli tool too

Minify - GO

It minifies html, css and other stuff and finally SVG, but still in development, worth to keep an eye on it:

https://github.com/tdewolff/minify/tree/master/cmd/minify

THE WINNER: SVG Cleaner - Rust

Their goals:

Correctness - svgcleaner should not break an SVG file Cleaning ratio - Higher is better Performance - An average SVG file processing time should be closer to ~1ms on a modern PC

They claim not to be focusing on speed, but it's fast, and the best it cleans really great!! xD

https://github.com/RazrFalcon/svgcleaner

And too keep my Docker containers thin, it's a small compiled binary

Look at their charts and tell me if it's not a fine piece of software.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment