2

Here are some fragments from the same .svg file made and saved by Inkscape:

<svg width="150" height="150" version="1.1" viewBox="0 0 39.688 39.688" ...
...
<path d="m-117.51 88.274c-1.6578 0.02054-2.2324 1.3125-4.1072 2.8502-0.85358...

The width and height are in px (because that was the unit I used to transform the shape - the values match). The viewbox unit is, apparently, in mm (because I used them to resize the document - again, the values match). So, svg doesn't care about mixing different units of measurement in the same file? Also, I couldn't find where it says specifically in the file which units are being used - very confusing.

However, what are the units of the path - I have no idea. They don't seem to match with node coordinates in Inkscape in whichever units. Is there any way to find out, or to pick the units when saving file? I do care because I want to round them to integers (I am going to import those files into Processing, and I don't want to deal with those long decimals there), and to round them, I need to know which units to round.

Thanks.

1

SVG does not really care of the unit at all. I mean it defaults to pixels, but mm is a pretty meaningless on a web browser.

Anyway the SVG viewer does not really know the unit is a mm or anything it just knows that your view box is 0-39.688 so it now knows 150 pixels is 39.688 units in your document. It does not really care what your unit is just as ling as it knows the conversion factor. I mean it may be mm or it might not be on a different device.

Incidentally not all parts of SVG needs to be in same scale so you can have mm and inches in same document. But the semantics means nothing to the computer. YOu are making the meaning out of it. So without seeing the actual transformation stack theres little that can be done to answer your question (so we need to know all groups etc.).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.