Wednesday, May 11, 2011

how to clean svg image files

.svg is an image file just like .jpg.Svg has its advantages,definitely(due to this advantages,google image prefers svg;have a look at this);but sometimes it comes with empty elements,unnecessary metadata,attributes which only contributed in increasing the file size of the original svg file.
To remove them or to clean .svg,"scour' will be needed.Scour is an open-source Python script that aggressively cleans SVG files.Optimisations performed by Scour on SVG files include: removing empty elements, removing metadata elements, removing unused id= attribute values, removing unrenderable elements, trimming coordinates to a certain number of significant places, and removing vector editor metadata.
But scour act only on files created by vector editors such as Inkscape and Adobe Illustrator.So caution is advised.
NEVER USE SCOUR TO OVERWRITE YOUR ORIGINAL FILE!
To use this follow the following instructions.Both command line and inkscape plug-ins are included
    Command Line Script
   
    To run scour on the command-line, first download and install Python, then download scour.  The basics are:
   
    $ python scour.py -i input.svg -o output.svg
   
    In addition, you can use compressed svg (.svgz) on the input and output and scour will decompress/compress automatically.
   
    Inkscape Extension
       
    If you want this in your Inkscape then download this zipfile, unzip it in your Inkscape's extensions/ folder.  Now when you Save As you will see an option for "Optimized SVG (*.svg)".  This extension is included with Inkscape 0.47.   
For further configuration and to download the file,go to this page http://www.codedread.com/scour/
Scour 0.26,the latest version at the time of writing this post,could be downloaded by clicking here.

No comments:

Post a Comment