SVG Cleaner 0.5: leaner, faster, runs on Mac

SVG Cleaner 0.5: leaner, faster, runs on Mac

The world's friendliest SVG batch clean-up program is back with a new major update: it's smaller, faster, goes easy on system resources, and finally runs on Mac.

The major change in this version is a whole new processing backend. The developer of the former, Perl-based, backend of the app left the project last year. So Eugene Raizner rewrote it in C++.

This new backend already has the most important features of its predecessor. Eugene tested it on ca. 20K files, and here are some results:

  • on average the new version is 5 to 8 times faster;
  • the memory footprint is at least 2 times smaller;
  • it's now possible to process 20MB+ large SVG drawings;
  • up to 45% excessive markup gets wiped out;
  • compression quality is ca. 1—2% worse than with the obsolete Perl backend;
  • probability of incorrect processing is estimated as 0.002%.

Thanks to removal of dependency on Perl it was possible to make the installation package for Windows smaller by order of magnitude. It also simplified providing a long anticipated Mac build.

Not only that, the backend can now run as a standalone console application, so you can use SVG Cleaner on a server. There's a caveat though: currently it cannot handle folders and SVGZ files, but that's not for long.

Among further plans Eugene has:

  • up to 75% excessive markup removal;
  • smarter ungrouping of g elements (groups with filters, masks etc. are currently bypassed).
  • the grouping of elements by full and partial matching of the style attribute;
  • the handling of path segments, the approximation of paths;
  • the removal of partially and/or completely identical elements;
  • the removal of overlapped and thus invisible elements;
  • the application of all transformation matrices;
  • switching from QtXml to libxml2, since the former is responsible for 1/3 of processing time;
  • better GUI with human-readable tooltips.

You can download the source code, as well as builds for Windows and Mac; there's also a PPA for Ubuntu. You can track the progress of the project on GitHub.

Was it useful? There's more:

6 Responses. Comments closed for this entry.

  1. Looking at the examples, it’s obvious this app reduces the size of files. I’m just wondering why don’t the editing apps (Inkscape, Illustrator, whatever) do this job when saving files? Why do they produce “dirty” SVGs that need cleaning?

  2. Alexandre Prokoudine 18 June 2013 at 8:03 am

    In general, it happens for all sorts of reasons.

    E.g. you created an object and filled it with a gradient or a custom pattern, but then removed the object. The gradient/pattern could still be useful, so its definition is preserved and saved.

    Or you created multiple objects in a large drawing, and they are them overlapped by bigger opaque objects.

    And apps that save SVG tend to use their markup to save some information. E.g. you can flatten that extra info about live path effects in SVGs produced by Inkscape. You will preserve the look, but you won’t be able to edit the effect again, so you wll only have the final path.

    Inkscape can save cleaned-up files, but it’s script (Scour) isn’t perfect. It also can save plain SVG which removes a lot of its own markup. And it also has ‘vacuum defs’ command in the File menu that removes unused definitions. Most other big apps that save SVG don’t do any of that.

  3. Inkscape trunk will optionally remove unneeded/incorrect attributes and properties. This can be turned on in the Preferences dialog under Input/Output -> SVG output.

  4. Once again a nice contribution to Mac. Seems that Mac and Linux are working continuously against Windows.

  5. interest!! Very nice explanation about SVG Cleaner