Removing all transforms from an SVG

Discuss SVG code, accessible via the XML Editor.
AdrianS627
Posts: 2
Joined: Sat Feb 06, 2016 4:07 am

Removing all transforms from an SVG

Postby AdrianS627 » Sat Feb 06, 2016 4:18 am

Hi

The question "how do I remove all transforms from an SVG?" seems to have been asked many times but there doesn't seem to be a definitive answer that works.

I am using Inkscape 0.91 and have an image composed of many paths with each one having a tramsform=translate(...,...) attribute. How do I remove all these?

Thanks

A.

Moini
Posts: 2233
Joined: Mon Oct 05, 2015 10:44 am

Re: Removing all transforms from an SVG

Postby Moini » Sat Feb 06, 2016 7:20 am

If you have groups or clones in your image, ungroup / unlink all of them.
If you have changed the document size at any point of time, create a new layer, move all contents into it, and delete the old layer.
In 'Edit -> Preferences -> Behaviour -> Transforms: Transforms' select Optimized
Just to be sure, select everything, then move it up with arrow keys one step and down again.
Save again.


This should remove most transforms, but maybe not all. If any are left, please indicate what kind of element still has them.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
brynn
Posts: 9612
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Removing all transforms from an SVG

Postby brynn » Sat Feb 06, 2016 9:24 am

I'm probably getting in over my head by asking this. But I'm curious why you would want to remove all transforms.

Maybe naive answer, but couldn't you remove the transform attributes using a text editor?

Lazur
Posts: 4421
Joined: Tue Jun 14, 2016 10:38 am

Re: Removing all transforms from an SVG

Postby Lazur » Sat Feb 06, 2016 9:43 am

Like using of tiled clones of groups with transformed objects inside.
Resizing page to selection or pasting objects from one window to another hardly works.

Or making animations.


If you remove them manually with a text editor they won't be applied -thus having a completely different appearance at rendering.

Moini
Posts: 2233
Joined: Mon Oct 05, 2015 10:44 am

Re: Removing all transforms from an SVG

Postby Moini » Sun Feb 07, 2016 3:23 am

why you would want to remove all transforms


The file will get smaller, and animations will be easier to apply, I believe.

but couldn't you remove the transform attributes using a text editor?


If you do that, the objects will all go back to their original places before they were moved, scaled, rotated....
The transforms will need to be applied to each node of each object, so all nodes are in the correct positions, and the image can look as before.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Removing all transforms from an SVG

Postby ~suv » Sun Feb 07, 2016 4:23 am

Moini wrote:
why you would want to remove all transforms

The file will get smaller, and animations will be easier to apply, I believe.

Another reason I recall having heard from users asking similar questions (e.g. on irc) are limitations of third-party applications or tools which the user plans to use to further process the SVG files (such tools may fail or produce incorrect results with files which have preserved transforms on objects (shapes, paths) or groups) [1].

--
[1] Transforms (depending on document structure, object types etc.) need extra care and efforts (code-wise) to be handled/compensated correctly - not every tool that parses and manipulates SVG data does implement full support for this particular aspect of SVG.


Return to “SVG / XML Code”

Who is online

Users browsing this forum: No registered users and 2 guests