SVG是否支持嵌入位图图像? [英] Does SVG support embedding of bitmap images?

查看:918
本文介绍了SVG是否支持嵌入位图图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SVG图像是纯粹的矢量图还是我们可以将位图图像组合成SVG图像?
如何在位图图像上应用变换(透视,映射等)?

Is an SVG image purely vectorial or can we combine bitmap images into an SVG image ? How about transforms applied on the bitmap images (perspective, mappings, etc.) ?

编辑:图像可能包含在通过链接引用的SVG。请参见 http://www.w3.org/TR/SVG/struct.html# ImageElement 。我的问题实际上是,如果位图图像可能包含在svg中,那么svg图像将是自包含的。否则,每当显示svg图像时,必须遵循链接并下载图像。显然.svg文件只是xml文件。

Edit: Images may be included in an SVG by link reference. See http://www.w3.org/TR/SVG/struct.html#ImageElement. My question was in fact if bitmap images may be included inside the svg so that the svg image would be self contained. Otherwise, whenever the svg image is displayed the link must be followed and the image downloaded. Apparently .svg files are simply xml files.

推荐答案

是的,您可以参考< image> 元素。您可以使用数据uri 来使svg完全自我包含。例如:

Yes, you can reference any image from the <image> element. And you can use data uri's to make the svg fully selfcontained. An example:

<image width="100" height="100" xlink:href="data:image/png;base64,...">

点是您添加编码的base64数据的地方,支持svg的矢量图形编辑器通常具有嵌入图像保存的选项。否则,有很多工具可以与base64进行编码。

The dots is where you'd add the encoded base64 data, vector graphics editors that support svg usually have an option for saving with images embedded. Otherwise there are plenty of tools around for encoding to and from base64.

这是一个完整的示例

这篇关于SVG是否支持嵌入位图图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆