svg loading ignores -density

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: svg loading ignores -density

Post by snibgo »

roelandsch wrote:It should still be possible to load those files with higher resolution than the default.
Yes.

There are many ways of specifying size within SVG: pixels, inches or user-units, either as width and height, or viewbox, or both. I don't fully understand the relationship between these methods.

I have seen cases where some rasterisers (eg in web browsers) don't function correctly when some formal declarations are not made in the SVG. So, rather than starting with...

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="100" height="100">
... I would start with:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100" height="100"
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink">
But test.svg given in the OP should scale with "-density".

For me, with IM v6.9.5-3 it does scale, whether the work is done by MSVG, RSVG v2.40.15 or Inkscape v0.91.

There may be a bug in later versions of IM.
snibgo's IM pages: im.snibgo.com
gringo974
Posts: 16
Joined: 2016-10-04T07:07:21-07:00
Authentication code: 1151

Re: svg loading ignores -density

Post by gringo974 »

Hello,

I'm not sure if this is the same issue but I reported a svg size bug on the version ImageMagick-7.0.3.

Here is my report:
https://www.imagemagick.org/discourse-s ... =3&t=30591


The issue has been fixed in version ImageMagick-7.0.4.
roelandsch
Posts: 20
Joined: 2014-10-27T16:10:38-07:00
Authentication code: 6789

Re: svg loading ignores -density

Post by roelandsch »

“I don't fully understand the relationship between these methods.”

Me neither, and there's some pretty weird examples on MDN (eg. width="150", height="100", viewbox="0 0 3 2"). RSVG loads that one as 150×100.

Anyway for now I can solve my problem by using inches. Thanks for looking into this.
Post Reply