I'm not 100% sure of the proper way to apply transforms in Inkscape.
What I found is that all transforms have to take account of the possibility that the layer ( group ) itself has a transform applied to it.
This happens often when the user has used Edit>Resize Page to Selection.
How I got around it is to wrap the group or object in another temporary group, then get the .composed_transform for the inner object, then pop it out and delete the temp group.
I could then multiply my own transform by the obtained composed transform.
This is probably not the way to do it, It's just something I came up with - It does work though.
here is the function I'm using and the error.
Any idea what might be wrong?
I'm not 100% sure of the proper way to apply transforms in Inkscape.
What I found is that all transforms have to take account of the possibility that the layer ( group ) itself has a transform applied to it.
This happens often when the user has used Edit>Resize Page to Selection.
How I got around it is to wrap the group or object in another temporary group, then get the .composed_transform for the inner object, then pop it out and delete the temp group.
I could then multiply my own transform by the obtained composed transform.
This is probably not the way to do it, It's just something I came up with - It does work though.
This extension uses that technique to translate : https://inkscape.org/~inklinea/%E2%98%85simple-registration
If anyone is able to post a fool proof way, I would definitely be interested.
regarding my bug...
.apply_transform() on Image: no bueno ... who knew.
removing it prevents the crash.
I'll check out your approach. That doesn't sound like an edge case I'll encounter.
Sneaking suspicion that I shouldn't be relying in .add_rotate.. and get jiggy with matrices instead.
Glad you found a solution.
I would point out then a lot of published clipart files created in Inkscape, already have layer transforms on them.
This is because the last stage of publishing is often to resize the canvas to suit the artwork.
It tripped me up in the beginning :)