在同一个 SVG 文档中多次重用图像数据 URI [英] Reusing image data URI multiple times in the same SVG document
问题描述
我在单个 SVG 文档中多次使用相同的图像.使用 xlink:href
多次嵌入相同的图像作为数据 uri 似乎是不必要的文件膨胀.
I'm using the same image multiple times in a single SVG document. Embedding the same image multiple times as a data uri using xlink:href
seems like unnecessary file bloat.
我目前拥有的是:<image xlink:href="data:image/png;base64..."
使用相同的数据 uri 多次出现.
What I currently have is: <image xlink:href="data:image/png;base64..."
appearing multiple times with the same data uri.
有没有办法在单独的 svg 元素中嵌入数据 uri,然后将所有 image
元素链接到它,从而避免数据重复?
Is there a way to embed a data uri in a separate svg element and then link all the image
elements to it, thus avoiding the data duplication?
推荐答案
您可以将图像放在一个符号中,然后将 元素指向该符号.
You could put the image in a symbol and then point <use>
elements at the symbol.
这篇关于在同一个 SVG 文档中多次重用图像数据 URI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!