Default bounding box should encompass entire drawing
When converting from SVG to SVG, the rsvg-convert
program should add a proper bounding box if the original SVG file lacked one. For example, consider this image, circle.svg
:
<svg>
<g>
<ellipse
ry="50"
rx="50"
cy="300"
cx="300"
/>
</g>
</svg>
Running rsvg-convert circle.svg -f svg
outputs the following:
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="100pt" height="100pt" viewBox="0 0 100 100" version="1.1">
<g id="surface3">
</g>
</svg>
Note that rsvg-convert correctly detected the bounding box size to be 100x100, but it did not get the correct position. It should have translated the drawing to the center instead of cropping it out.
It would be handy if this was fixed, as it is not uncommon to find broken SVG files that need to have their bounding box recalculated. For example, there is a stack exchange question to which the answer ought to be, "just use rsvg-convert", instead of doing some silliness with Javascript.