3

when I use preserveAspectRatio=none for an image in a SVG file it does not seem to work in Google Chrome. The SVG does not scale according to the image width and height.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg  id="test" 
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 1024 768"> 
<defs>
</defs>
<image x="288" y="140" width="368" height="160" xlink:href="image.svg" preserveAspectRatio="none" />
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg  id="test" 
xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 1024 768"> 
<defs>
</defs>
<image x="288" y="140" width="368" height="160" xlink:href="image.svg" preserveAspectRatio="none" />
</svg>

In IE9, latest Opera and FF it works!

It seems that it does not work if the image that should be included has not the attribute preserveAspectRatio=none. I cannot assume that every SVG has this attribute. So I need to know how to overwrite such an attribute in case the SVG is embedded with 'image' tag.

Matthias
  • 1,386
  • 3
  • 24
  • 59
  • `none` works now (Chrome 60, July 2017), but the other values are interpreted as `xMinYMid meet`. – phk Jul 10 '17 at 15:12

1 Answers1

-1

http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute
Please try "defer".
But I think chrome does not support this value.

defghi1977
  • 5,081
  • 1
  • 30
  • 29