There is also an option to Inkscape called --query-all that will give you the dimensions without opening up a GUI. Using these, you can crop the SVG with some simple code. I just wrote a tool to do this in Python:

https://github.com/skagedal/svgclip

When trying to google a method for doing this tonight, this was one of the first posts I found, so I thought I'd get back and tell you what I ended up with 🙂

Regards, Simon