GodSVG icon indicating copy to clipboard operation
GodSVG copied to clipboard

Apply transform-list attributes for optimization

Open athyfr opened this issue 8 months ago • 4 comments

Currently, my workflow is to design in Inkscape, and to optimize/tweak in GodSVG. Inkscape can often insert matrix transforms, which I'd rather just be applied to the coordinates themselves.

A feature that would would directly solve this problem is applying transform-list attributes.

Transform-list attributes can take take up a lot of space, especially matrix.

  • matrix(x1 y1 o1 x2 y2 o2)
  • rotate(d ox oy)
  • translate(x y)
  • scale(x y)
  • skewX(d)
  • skewY(d)

Applying a transform would mean that the coordinates of e.g. the path would be modified to account for the transform, and then the transform is removed. This would have no side-effects, besides quantization.

It could be incorporated into the optimize option, depending on settings, and could also be applied to a transform manually, via the GUI editor (listed before delete).

This feature could be of great utility to optimizing SVGs.

Looking forward to the future of this great tool!

athyfr avatar Apr 17 '25 18:04 athyfr

Thanks for the proposal! I've been planning to add this for a long time, but I've been postponing it for until I rework the inspector.

MewPurPur avatar Apr 20 '25 09:04 MewPurPur

This would be the singular feature that makes GodSVG useful to me, which is my only use case where I'd need a tool like this. I so far haven't found any other tool that lets me apply transforms while otherwise cleanly preserving the SVG syntax. Thanks for considering adding this!

Keavon avatar Sep 08 '25 22:09 Keavon

If you need it for the whole SVG, I could consider adding it to the optimizer for alpha 11. The optimizer is currently very primitive, it doesn't do much, but it will eventually also be more fine-grained, so you'd be able to only turn on this optimization and nothing else. These are also separate from the elusive inspector rework which honestly seems like it will happen next year.

MewPurPur avatar Sep 09 '25 01:09 MewPurPur

That'd be enough for my purposes, but I also envision a case where you can click on any element and apply its transform inwards— so a group could apply its transform to its direct children's transforms, and those transforms for shape elements could apply to the actual points of a path or x/y and other (compatible, i.e. no skew for an ellipse's radii) attributes.

Keavon avatar Sep 09 '25 01:09 Keavon