Introducing SVG Cleaner

Introducing SVG Cleaner

If you do a lot of drawing in Inkscape, you know that unused elements tend to accumulate and blow up size of SVG documents. This is where recently released SVG Cleaner 0.2 comes to rescue.

Basically the application does two things:

  • removing elements and attributes that don't contribute to the final rendering;
  • making those elements and attributes that are actually used more compact.

While Inkscape's Vacuum Defs command only cleans up unused gradients and suchlike, and Scour-based exporter provides some additional options, SVG Cleaner provides far, far more options and works in batch mode.

Besides, you still need cleaning up files from Adobe Illustrator and Corel DRAW (Inkscape can do it for the former, btw).

Here is a quick demo of the application:

The core Perl script was written by Andrey Bayrak, and the user interface (Qt4) was written by Eugene Raizner. So, I figured I'd ask Andrey a couple of questions.

In your own words, what kind of users and uses are you targeting at with this application?

The particular task we are trying to address with SVG Cleaner is a complete automation and visualization of cleaning and optimizing SVG files. We are helping users to avoid doing this kind of repetitive tasks manually. Hopefully anyone who works on web design or UI design will find it useful.

Where did you get the idea of SVG Cleaner from?

Some two years ago or so I had to do a batch cleanup of a pile of SVG images. So I googled for an application that would allow me to do that, and I found nothing. The best tool for cleaning SVG documents was Scour which was already part of Inkscape by the time.

File processing options

Why didn't you go for Scour as the core of your application?

Don't get me wrong, Jeff Schiller did a huge amount of work, however in my experience Scour has a number of disadvantages:

  • cannot work in batch mode on its own;
  • has too few options for cleanup and optimization;
  • in some cases it corrupts shapes and paths;
  • cannot process large images fast.

Here is just a quick example for the last point: it took Scour 0.26 no less than 3m18.446s to cleanup this 1.1 MB large SVG document. The upcoming SVG Cleaner 0.3 only needed 0m13.665s. Besides Scour's output was 533KB, while SVG Cleaner — just 377.5KB).

Elements cleanup options

The other reason is that I'm not a big fan of Python, so I decided to do the core in Perl which I like, and to work on my own optimization algorithms. And since I'm a hardcore KDE user, I decided to provide a UI with lots of options so that it's up to the user what to optimize and cleanup.

What's your main focus in SVG Cleaner?

We pay a close attention to preserving original look of the optimized images, and we also care a lot about performance.

What are your future plans?

Mostly those are:

  • implementing the rest of Scour features
  • further work on our cleanup and optimization algorithms, especially to provide even smaller files;
  • better, more informative user interface;
  • creating help system.

Stats for each pair of images

SVG Cleaner is currently available as source code from Bazaar repository at Launchpad and from PPA for Ubuntu by its developers. Builds for Windows and Mac are currently not available.

Was it useful? There's more:

12 Comments

Leave a comment
  1. I use Inkscape for all my vector drawings,sometimes with lot of elements SVG file start to feel a little heavy, I will like to try SVG Cleaner but is there version for win7.Thanks and regards.

  2. Alexandre Prokoudine 29 January 2012 at 3:07 am

    Yes, v0.3 is coming with a Windows installer today hopefully.

  3. Thanks I will try it.
    Is the “SVG Cleaner” real name for the program in Ubuntu software center.
    Screens looks like they are taken on Ubuntu Linux?

  4. Just look for “svg” in the software senter after adding the PPA. Yes, It’s Ubuntu 11.10 :)

  5. I believe this can help a lot for the Ubuntu “cd space” problem. Let’s hope they’ll start to clean up icons in this way. :)

  6. This SVG Cleaner is a cool software, does this have a version that is applicable not only for Ubuntu? Something for Windows?

  7. Alexandre Prokoudine 04 January 2013 at 2:23 pm

    v0.4 is available for Windows. Check http://qt-apps.org/content/show.php/SVG+Cleaner?content=147974

  8. A note to Ubuntu and all Linux users, SVG Cleaner ROCKS!
    Before my plan was 900 Kbites obese, and didn’t upload to Ponoko;
    After a pass trough SVG Cleaner, it was 500K, and went up in a few seconds!
    Thanks, guys.
    In case you’re curious, it’s this plan:
    http://www.ponoko.com/design-your-own/products/fonly-lathe-4-9834

  9. Alexandre Prokoudine 18 April 2013 at 2:10 pm

    @Edgar, awesome!

  10. Thanks! :)
    Not all of the Fonly, there, but the basics are, and I’ll try to squeeze the rest in.

  11. Just wanted to thank the creator )

  12. I’m having a little technical problem for my website. I’m using Bannersonthecheap.com as my preferred online website. Kindly check for your reference (customer able to attach pictures to the template, insert, upload pictures, text, colours) I have no problem with the clipart (see above website for the DIY)

    I’m having technical problem of preparing the template. My designer has done the templates including all the vector images based on openclipart.com on AI. However, understand from our local website designer, he said that the images clipart contain inkscape. I have prepared more than 250 such files in vector. Kindly assist me how to cleanup the inkscape.

    Need your immediate assistance to resolve this issue. Your kind assistance is greatly appreciated. Hope to hear from you by today.

    Thanks and warm regards


    John Sie
    90296107
    .(JavaScript must be enabled to view this email address)

Tell us what you think

Submit the word you see below: