Removing transforms in SVG files
I have been struggling with this for a while, and can't seem to find an answer (that works) anywhere. I have an SVG file which looks like this:
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
...
width="72.9375"
height="58.21875"
...>
...
<g
...
transform="translate(10.75,-308.96875)"
style="...">
<path
inkscape:connector-curvature="0"
d="m -10.254587,345.43597 c 0,-1.41732 0.17692,-2.85384 0.5312502,-3.5625 0.70866,-1.41733 2.14518,-2.82259 3.5625,-3.53125 1.41733,-0.70866 2.11392,-0.70867 3.53125,0 1.41732,0.70866 ... z"
... />
</g>
</svg>
I want to remove the transform="..."
line but still have my image stay where I've placed it (in InkScape). If I manually remove the transform, the image zips to another part of the screen (as expected), but I need to get rid of the transform altogether and, at the same time, have the image stay exactly where I want it. Is there a way to remove/flatten the transforms into the path coordinates themselves? (The only transforms I have to deal with are translate and scale, no matrices.)
How to remove transforms in Inkscape
- Open svg file in Inkscape
- Go to Edit -> Select All
- Go to Object -> Ungroup
- Go to Edit -> XML Editor
- Find "transform" attributes in layers and delete them
How to move all objects altogether without creating another transform attributes
- Go to Edit -> Select All in All Layers
- Go to Object -> Transform
In Transform panel
- Uncheck Relative move and check Apply to each object separately
- Set Horizontal and Vertical values according to your needs and click Apply
There is inkscape extension called Apply Transforms that recomputes paths with their transforms. This is exactly what I've been looking for.
After installing it you'll find it menu under Extensions > Modify Path > Apply Transform.
credits: Inkscape forum > Remove all transforms whilst keeping in-place