I'm facing a SVG convert size issue with SVG that uses metric system units (mm, cm, in).
Here is a simple SVG that draws a red square of 10mmx10mm :
Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10mm" height="10mm">
<rect x="0" y="0" width="10mm" height="10mm" style="fill:rgb(255,0,0)" />
</svg>
But all others dpi give a wrong size!
For example:
- The 300-dpi convert creates a 393x393 pixels image intead of 118x118 pixels (300*10/25.4)
- The 600-dpi convert creates a 1573x1573 pixels image intead of 236x236 pixels (600*10/25.4)
Code: Select all
(line 3003) image->columns=image->resolution.x*dimension_info.width/90.0;
Actually the resolution is applied twice, one time on the dimension_info and one time on the image->columns.
So to quick fix this issue, I commented the rsvg_handle_set_dpi_x_y call :
Code: Select all
(line 2970), //rsvg_handle_set_dpi_x_y(svg_handle,image->resolution.x,image->resolution.y);
image->columns=300*35/90=116 pixels (which is better but due to approximation not really accurate)
It could be nice if you could provide a accurate fix!