Get the real size of a SVG/G element

后端 未结 4 1214
耶瑟儿~
耶瑟儿~ 2020-12-24 02:31

Is there any accurate way to get the real size of a svg element that includes stroke, filters or other elements contributing to the element\'s real size from within Javascri

4条回答
  •  鱼传尺愫
    2020-12-24 03:12

    You didn't specify any programming language. So I can suggest to use Inkscape.

    In the file menu you find document's properties and in the first page there's "resize page to content" command. In this way you remove all the white space around your draw and you see the real size. After width and height values apprear inside the header of svg.

    I know that Inkscape supports scripting and command line operations but I don't know if it's possible to do the trimming operatation in this way. But if it's possible you can do that from every programming language.

提交回复
热议问题