webecon
webecon

Reputation: 79

Inkscape extension, how to get a g element width and height?

I know about:

node.get("wight")

or:

node.attrib("wight")

But for elements that don't have their attibute, like g element. How can I get the width?

Upvotes: 0

Views: 391

Answers (1)

Moini
Moini

Reputation: 1387

You can either use the Inkscape command line to get an exact width/height:

inkscape file.svg --query-width --query-id

(The returned value is in px (SVG user units), see https://inkscape.org/en/doc/inkscape-man.html#OPTIONS )

Or you can use the (imperfect) convenience functions provided by the file simpletransform.py that can be found in Inkscape's extension directory, i.e. computeBBox() .

Upvotes: 1

Related Questions