简体   繁体   English

如何在SVG中缩放图像

[英]How to NOT scale an image in SVG

So I have an image in SVG as follows: 所以我在SVG中有一个图像如下:

<image id="svgBackground" x="0px" y="0px" width="100%" height="100%" preserveAspectRatio="xMinYMin" xlink:href="backgrounds.png"/>

I want the browser to show the image at the original size. 我希望浏览器以原始大小显示图像。 How do I do that? 我怎么做?

Specify the image's original size using "px" units: width="150px" height="100px" or whatever it ought to be. 使用“px”单位指定图像的原始大小: width="150px" height="100px"或它应该是什么。

If you omit width and/or height entirely, it defaults to zero and the image is not rendered. 如果完全省略width和/或height ,则默认为零,并且不渲染图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM