SVG conversion output size depends on Inkscape version (96 dpi since Inkscape 0.92)
Posted: 2017-01-30T10:02:09-07:00
It seems that convert delegates SVG conversions to Inkscape if possible:
The problem is that the latest Inkscape release, 0.92, changed the default DPI from 90 to 96. Previously, in Inkscape 0.91, --export-dpi=90,90 did not do anything; it just converted 1 "SVG unit" to 1 pixel. But with Inkscape 0.92, this actually converts 1 unit into 90/96 pixel, so the output image size is different.
As a temporary workaround that doesn't require me to modify ImageMagick itself, I have found that I can modify /etc/ImageMagick-6/delegates.xml, changing this line:
... into this:
This replaces --export-png by --export-margin. We can't just remove the flag, because there is a fixed series of %s substitutions that should not be messed with. This hack works because --export-margin only applies to PS/EPS/PDF export, and is ignored otherwise.
Using Arch Linux, ImageMagick 6.9.7-5.
Code: Select all
$ convert -verbose input.svg output.png
'inkscape' '/tmp/magick-7021NuwMejdeE5J' --export-png='/tmp/magick-7028UtiZe34gdWV' --export-dpi='90,90' --export-background='rgb(100%,100%,100%)' --export-background-opacity='1' > '/tmp/magick-7024PjbEew5AMM7' 2>&1
As a temporary workaround that doesn't require me to modify ImageMagick itself, I have found that I can modify /etc/ImageMagick-6/delegates.xml, changing this line:
Code: Select all
<delegate decode="svg:decode" stealth="True" command=""inkscape" "%s" --export-png="%s" --export-dpi="%s" --export-background="%s" --export-background-opacity="%s" > "%s" 2>&1"/>
Code: Select all
<delegate decode="svg:decode" stealth="True" command=""inkscape" "%s" --export-margin="%s" --export-dpi="%s" --export-background="%s" --export-background-opacity="%s" > "%s" 2>&1"/>
Using Arch Linux, ImageMagick 6.9.7-5.