Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.)

like image 901
Ephemera Avatar asked Oct 01 '22 10:10

Ephemera


2 Answers

How to remove transforms in Inkscape

  1. Open svg file in Inkscape
  2. Go to Edit -> Select All
  3. Go to Object -> Ungroup
  4. Go to Edit -> XML Editor
  5. Find "transform" attributes in layers and delete them

How to move all objects altogether without creating another transform attributes

  1. Go to Edit -> Select All in All Layers
  2. Go to Object -> Transform

In Transform panel

  1. Uncheck Relative move and check Apply to each object separately
  2. Set Horizontal and Vertical values according to your needs and click Apply
like image 210
Sergiy Seletskyy Avatar answered Oct 14 '22 00:10

Sergiy Seletskyy


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

like image 73
piotr_cz Avatar answered Oct 14 '22 01:10

piotr_cz