Comment 0 for bug 368542

Tools such as Inkscape inject a lot of 'cruft' which the author may not intend to include in the file once uploaded. Examples of this are:

- unreferenced gradients, patterns, or fills
- sodipodi/inkscape/adobe elements or attributes
- references to external raster images

I have started a project to help clean SVG files: http://codedread.com/scour/

The results on some of my test files have been a dramatic reduction in file size (0.4x)

It would be great if during the submit process there was a means of scouring the SVG file. My thoughts are along the following lines:

1) user clicks a "Upload button" and is taken to the upload form page
2) user clicks a button to choose her local SVG file
3) user has the option to 'scour' the SVG file by checking a box marked "Clean SVG File before uploading?" (this could be checked by default)
4) user clicks "Next"
5) user is presented with the SVG file in an object/iframe for visual inspection (in addition a link to the scoured file is given)
6) user clicks "Back" if they don't like the scoured version or user clicks "Done" if they like it

The above would require a copy of scour running on the web server. Note that references to local rasters will be broken (because those rasters won't be present on the web server). This will be immediately obvious to the user upon step 5 and prevent problems such as http://blog.codedread.com/archives/2008/08/27/inkscape-bug-with-embedded-rasters/

There is one potential hiccup in the above scenario: If the user is using a browser that doesn't support SVG (in other words, Internet Explorer without a SVG plugin). In that case, a link to the scoured file can be present and a mention that they should be using a cooler browser :)