Non optimal SVG
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Confirmed
|
Low
|
Unassigned |
Bug Description
I love InkScape, but have noticed that the SVG produced is a lot fatter than it needs to be. At present I am using a custom script to trim down my files to more optimal values, but it is limited in how much it can do.
Some of the excess size is due to a lack of optimizations (which is more a feature request than a bug), but some of the excess I would consider to be a bug.
Here are some of my suggestions. Some of these could be done on the fly, others might be more suited to an "optimize function", where parameters could be entered. I hope they may be of use...
1. Don't define attributes if they are the default.
From the SVG spec - "Use default values whenever possible rather than defining all attributes and properties explicitly".
2. Remove text related attributes when converting to path.
It appears that even after converting text to a path, and even breaking up the path, the text attributes relating to font-size, etc remain in the attributes for the path (bug?).
3. Reduce number of decimals stored.
I've noticed that a lot of values are stored to a decimals precision far greater than is likely to be needed, especially after a transformation has occurred. For example a line width of "4.00000013" would probably be okay just as "4".
In some cases I have even seen values that use scientific notation for points. E.g. "4.10324234e-13" which would probably be better off as just "0".
4. Resolve transformations.
It would be nice to be able to force a transformation to be resolved down to the path level. I.e. If I have a group with paths in it, and the path has a transform on it then the transformation could be applied to every point in the path and then removed from the group. This would be straightforward for an x and y move, but would also be good to do for scaling.
5. Remove excess.
I'd love to see a function that could go one step further and remove all the inkscape/sovipodi specific tags/attributes, and also remove all unnecessary whitespace, to create a really tight SVG file.
Mon, 22 Jun 2009 07:24:41 -0000
xtempore <email address hidden> kirjoitti:
> 4. Resolve transformations.
> It would be nice to be able to force a transformation to be resolved
> down to the path level. I.e. If I have a group with paths in it,
> and the path has a transform on it then the transformation could be
> applied to every point in the path and then removed from the group.
> This would be straightforward for an x and y move, but would also be
> good to do for scaling.
Inkscape does this to some extent, but a transformed path and path with
resolved transformation aren't exactly the same thing. For example,
with filter effects applied, they can look completely different.
> 5. Remove excess.
> I'd love to see a function that could go one step further and remove
> all the inkscape/sovipodi specific tags/attributes, and also remove
> all unnecessary whitespace, to create a really tight SVG file.
inkscape and sodipodi specific attributes are removed when saving as
Plain SVG.
--
Niko Kiirala
<email address hidden>