本页使用了标题或全文手工转换

帮助:SVG

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
This page is a translated version of a page Help:SVG and the translation is 55% complete. Changes to the translation template, respectively the source language can be submitted through Help:SVG and have to be approved by a translation administrator.
Outdated translations are marked like this.

Shortcut: COM:SVG

SVGぶんけん格式かくしきてきかんかた标志

SVG缩放りょう图形これ维基どもとおる资源ところ接受せつじゅてきいちぶんけん格式かくしき。其适ごうよう于图ひょう图,以及其他てきあきらかた类图ぞう。SVGざいともとおる资源受到高度こうど评价,いん为其使用しようみなもとだいらい描述图形对象,いん此目ぜん提供ていきょうりょうおさむあらためあずかつつみます内容ないようてきさいけい方法ほうほう

SVGぶんけんざい维基どもとおる资源じょうやめいた广泛使用しよう。这里ゆういち些入门指南しなん(如果您已经知どうよう使用しよう什么ほどじょらい生成せいせい此类ぶんけんじょ以下いか内容ないようがい,还可こう虑浏览Help:Illustrator/zhあるHelp:Inkscape圖形ずけい編輯へんしゅう)。

什麼いんも SVG?

いちふくSVG图像样例——请注意ちゅうい,无论您以なん比例ひれい查看图像,其线じょうはじめ终显とく平滑へいかつかい现“锯齿”

缩放りょう图形(SVG)いちXML规范以及ぶんけん格式かくしきよう于描じゅつせい态或动态りょう图形あずかくらい图或栅格图あい对)。它以纯文ほんある压缩(进制)格式かくしきそん储,这比其他多数たすう图像格式かくしき(如JPEGあるGIF具有ぐゆうさらだかてき尺寸しゃくすん效率こうりつ。SVG还允许嵌入かんにゅう栅格图形あずか编辑ぶんほん

librsvg

librsvgあるもの“RSVG”)MediaWiki使用しようてきいち个将SVGぶんけん栅格なり为维もとどもとおる资源网页所用しょようてきPNG图格しきてき渲染库。きょうとおる资源页面显示てき图像并非SVG,いん此也具有ぐゆう动画ある交互こうご效果こうか。做出这一选择的原因之一是,实时渲染SVGかいくだていろうきゅう计算つくえある操作そうさけい统的速度そくどよしSVGだかこう转换出来できてき栅格ばん本有ほんゆうじょ克服こくふく这一わざ术问题。另一个原因是一些SVGぶんけん非常ひじょうだいれい如1 MB),一副在显示屏上显示为160×320ぞう素的すてき图像,如果经压缩可达51200ぞうもと(24色彩しきさい达153600节)。

As of May 2023, Commons is running librsvg 2.44.10 (phab:T193352), already four years old by the time of its adoption. This is an early version of the librsvg rewrite in Rust programming language. Although it manages to fix longstanding problems such as the mask bug (phab:T55899) and provides initial support for SVG 2.0, some fixes on the upstream remain unavailable to us due to our old Debian release. See (phab:T265549) for the latest updates.

librsvg一些漏洞和缺少的功能会影响共享资源上的SVG图像。よし此,SVGぶんけんりょくもとめかい决或避免这些问题。れい如,librsvg支持しじみち文字もじてきこうのう,并且对于从上いたしたてき竖列ぶんほん方面ほうめん存在そんざい问题。そく使つかいlibrsvg以完运行,也可能かのう存在そんざいけんようせい问题。SVGぶんけん还可能会のうかい使用しようどもとおる资源ちゅうぼつゆう支持しじてき字体じたい

かいへき

樣式ようしき

ざいSVG規範きはんちゅうstyle元素げんそMUST默認もくにんtype屬性ぞくせいため"text/css"[1] 使用しようstyle元素げんそてきSVG圖像ずぞうおうざい‎<style>しめぎくじちゅう明確めいかく設置せっちtype="text/css"。(かわはなしせつ‎<style type="text/css">おう該優さき‎<style>。)(phab:T68672)

ぶんほんのう显示 / 浮动元素げんそ

まいり§ ぶんほんのう显示(浮动文字もじBUG)

systemLanguage 处理

私人しじん使用しようlangtag qcsらい选择zh-Hans
私人しじん使用しようlangtag qctらい选择zh-Hant

RSVG 无法せい确比较 systemLanguage 属性ぞくせい,SVG 指定していてき逗号ぶんへだたてき IETF 语言标签 (langtag) れつひょう。 RSVG 仅匹はい langtag ちゅうてきだいいち个子标签(だい一个连字符之前的字符组),いん此 RSVG かいゆるがせりゃくきさきめんてきにんなん国家こっかだい码或脚本きゃくほん标签。 れい如RSVGかい区分くぶんzh-Hans(简体ちゅうぶんzh-Hantしげるたいちゅうぶん)。 ようかい决该问题,使用しよう专用 langtag(qaa-qtz 范围内的ないてきいち个)らい指定してい语言。

IETF 语言标签 SVG 标记
sr-Cyrl systemLanguage="sr-Cyrl,qsc"
sr-Latn systemLanguage="sr-Latn,qsl"
zh-Hans systemLanguage="zh-Hans,qcs"
zh-Hant systemLanguage="zh-Hant,qct"

systemLanguage 属性ぞくせい应该 IETF 语言标签れつひょう。 关于せい确的语言标签存在そんざいいち混淆こんこう。 对于塞尔维亚语,MediaWiki いちちょくざい使用しよう sr-EC sr-ELただしざい BCP 47 ,这些标签表示ひょうじ EC(やくふり尔)地区ちくしょ说的ふさが尔维亚语しょ说的ふさが尔维亚语 ざい EL(分配ぶんぱい区域くいきちゅうせい确的语言标签 sr-Cyrl sr-Latn。 如果よう声明せいめいりょう包括ほうかつ sr てき语言くび选项,西里にしざと尔语 langtag 应该ざいひしげひのと语 langtag まえ,以使 SVG 1.1 switch 处理选择西里にしさと尔文脚本きゃくほん。 (MediaWiki 开始使用しよう适当てき语言标签;さんPhab:T117845。)

ちゅうぶん较复杂。 zh 引用いんよう所有しょゆう中国ちゅうごく方言ほうげんれい如,普通ふつう话或粤语)てきひろし语言标签。 使用しよう zh-cmn 指定してい普通ふつう话,ただし IETF ちゅうさつひょう[2] さら使用しよう cmnどう样,IETF さら使用しよう yue さく为粤语,而不 zh-yue指定していちゅうぶん文字もじHans为简たいHant为繁たいちゅうぶん使用しよう哪些语言标签ひさし清楚せいそ。 一个简单的方法就是使用 zh-Hans ある zh-Hant らい指定してい脚本きゃくほん(IETF ちゅうさつひょうはた两者标记为“冗余”ただし提供ていきょうくび选替だい方案ほうあん)。 另一种方法是指定方言和脚本,れいcmn-Hans ある cmn-Hant附加ふか区域くいき语言标签:cmn-Hans-CN中国ちゅうごく使用しようてき简体普通ふつう话)。

对于 MediaWiki,ふさが尔维亚语页面ゆう一个共同的来源,以用西里にしさと文字もじあるひしげひのと文字もじてい现。 どう样,ちゅうぶん页面ゆう一个共同的来源,以用 Hans ある Hant てい现。 理想りそうじょう况下,中国ちゅうごく读者以选择汉文章ぶんしょうちゅうてき所有しょゆう图像也将以汉てい现。 もちてき效果こうか类似于

  • [[File:xyz.svg|lang=zh-hant|...]] ようzh-Hant 阅读
  • [[File:xyz.svg|lang=zh-hans|...]] ようzh-Hans 阅读

目前もくぜんひさし清楚せいそ这是いや以或如何いかざい MediaWiki ちゅう完成かんせい

为维もとどもとおる资源创建SVG图像

你可以用らい创建SVG图像てきほど序列じょれつざいりょうきさき边的§ 编辑あきら节。你也以选择直接ちょくせつ使用しようにんなんぶんほん编辑あるIDE编写SVGだい码。

以下いかかく节解释SVGてき特定とくていこうのう

うえ传之まえ:验证并检查图ぞうがい

验证

つきかん维基どもとおる资源并未ゆう硬性こうせい要求ようきゅう过最こうじょう传前ようまん维网联盟(W3C)てきXML验证https://validator.w3.org)运行いち你的ほどじょ。验证以找到SVGぶんけんちゅう存在そんざいてき于不どう平台ひらだい渲染错的问题。れい如,其会对flowText元素げんそてき使用しよう报错,前者ぜんしゃ并非标准,也很しょう受到支持しじ过验证文けん通常つうじょう不能ふのう证明おもしんうえ传是合理ごうりてき[3]对于例外れいがいじょう况,请见优化已上いじょう传的SVG

如果SVGぶんけんゆうぶん档类がた声明せいめい,验证かい使用しよう它的ぶんけん类型描述(DTD)检查语法。如果ぼつゆうぶん档类がた声明せいめいすんで要求ようきゅう也不推荐),[4][5]验证ほどじょ可能かのうかい检查ぶんけん为格しきせい确的XML,ただし它也可能かのう识到该文けんSVG,并通过将ぶんけん传递给nu验证らい执行DTD验证。 ざいW3C验证网页ちゅうわが们选择以SVG 1.1らい验证ぶんけん。(ざいそくはた发布てきSVG 2草案そうあん中将ちゅうじょうかいうつりじょ对SVG DTDてき引用いんよう[6]

如果SVGぶん档中存在そんざい其他命名めいめいそら间,验证かい报错。许多工具こうぐ如Adobe IllustratorInkscape,みやこすすむ节点插入そうにゅういた其他命名めいめいそら间中。

通用つうようぜん 命名めいめい空間くうかん 目的もくてき
cc http://creativecommons.org/ns# 权限许可
cdml http://www.freesoftware.fsf.org/bkchem/cdml 化学かがく图表
dc http://purl.org/dc/elements/1.1/ もとすうすえ
i http://ns.adobe.com/AdobeIllustrator/10.0/ Adobe Illustrator
inkscape http://www.inkscape.org/namespaces/inkscape Inkscape
its http://www.w3.org/2005/11/its Internationalization Tag Set(ITS)
rdf http://www.w3.org/1999/02/22-rdf-syntax-ns# 资源描述格式かくしき
serif http://www.serif.com/ Serif Affinity (used for object names that couldn't be stored in the standard id attribute because of unsuitable characters like space)
sodipodi http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd 图形
svg http://www.w3.org/2000/svg SVG
xlink http://www.w3.org/1999/xlink XML链接语言

如果为 W3C 验证提供ていきょうりょういち个文けん,该文けん使用しよう适当てき Content-Type HTTP header么该ぶんけんはた验证为 SVG 1.1+XHTML+MathML 3.0(UI ひしげかまちちゅう可用かようてき选项)。 该验证由だい二个更现代的验证器 nu Validator (https://validator.w3.org/nu) 完成かんせい。 此外,验证かいrdf 命名めいめいそら元素げんそ树发错误,并将使用しようしき检查 inkscape sodipodi 命名めいめいそら间。 SVG 1.1+XHTML+MathML 3.0验证ゆかり {{ValidSVG}} 使用しよう

其他名称めいしょうそら间仍かい导致验证错误。 使用しよう nsfilter まいりすうつげ诉 W3C nu 验证抑制よくせいゆう关其命名めいめいそら间的错误。[7]

此外, SVG 1.1 属性ぞくせいはた产生验证错误。 SVG 2.0 草案そうあんまこと许用户像 HTML 5.0 いち包含ほうがん任意にんい data-* 属性ぞくせいただし W3C 验证かいだき怨它们。

まいり§ 标记SVGぶんけん一节了解如何标记有动画效果的SVGぶんけん

图片がい

不同ふどうてき软件ほどじょ不同ふどうてき浏览平台ひらだい可能かのうかい以略ゆう不同ふどうてき方式ほうしきてい完全かんぜんしょうどうてき SVG ぶんけん。 您在りょう图像编辑ちゅう查看さい终图ぞうてき方式ほうしき可能かのうかい反映はんえい该图ぞうじょう传到 Commons 并被其他人たにん查看きさきてきそと观。 此外,ざい维基百科文章中使用时,所有しょゆう SVG 图像都会とかい动转换为 PNG ぶんけん,这也可能かのうかいかげ响最终图ぞうてきそと观。 さく为前しゃてきしめせれいざい包含ほうがん一系列非常精细的笔画的图像中,这些笔画ざい编辑ちゅうおこりらい可能かのうはた图像转换为 SVG 并在 Web 浏览ちゅう查看时更あらさらあら些创けん SVG ぶんけんてきじん应该こう虑将们的作品さくひん保存ほぞん为 SVG 格式かくしきしかきさき使用しよう两个ある三个不同的浏览器打开同一图像以验证它是否按预期呈现。 也可以通过在其他图像编辑ほどじょちゅう开文けんらい进行类似てき检查。

よう预览 SVG 如何いかざい Commons じょうてい现为 PNG,请转到 Commons SVG Checker

どう一文件根据上下文呈现不同的原因是这些上下文(浏览あるほどじょ如何いかかい释文けんてき SVG だい码并使用しよう该代码生成せいせい图像てき结果。 标是创建いち个“最小さいしょうこう分母ぶんぼてき SVG,无论使用しよう什么浏览开它のうせい确呈现,并且なが不要ふようかり设您自己じこてき图像编辑ほどじょこう展示てんじ图像对其观众てき实外观。 ざい Web 浏览(而不りょう图形编辑ちゅう预览 SVG 揭示けいじいち些问题。 它有时有じょ于调せい调整 SVG だい码,ゆう其是あずか DOM Inspector 工具こうぐ结合使用しよう时。

此外,ぼう些程じょまこと许您はたもと于光栅的组件插入そうにゅういた您的ぶんけんちゅう,而不かい警告けいこく您如はてぶんけん转换为 SVG,这些组件はた会同かいどう时转换为りょう,这意味いみ可能かのう需要じゅよう非常ひじょう小心しょうしん过滤てき种类 效果こうか包含ほうがんざい图像ちゅう,并且ざいしょう SVG じょう传到 Commons ぜん应该检查图像ちゅういやゆうにんなん无关てき嵌入かんにゅう“链接”。 如何いか做到这一点因程序而异。

ただし,如果您使用しようてき Adobe Illustrator,以下いかしめせ例会れいかい导致插画そうが师将みち转换为光栅组けん

  • 应用于任なにはまたかしてきにんなん图案,包括ほうかつ包含ほうがんざい Illustrator ちゅうてき图案。 ゆう时,您可以通过自おのれはた使用しよう过的にんなん图案转换为光栅,しかきさき使用しよう图像--> 跟踪こうのうはた它们转换かいりょうらいかい决此问题。
  • 包含ほうがんとめいち个 Illustrator てき效果こうかてきにんなんみち——れい如,鱼眼扭曲徒手としゅ扭曲。插画そうが师无ほう在任ざいにんなん单个みちてきそと观”さい单中处理其中两个,并且かいはた它们栅格
  • にんなにやめつつみ络失真改しんかい变的みちゆう时您以像かい上述じょうじゅつしき问题一样解决这些问题,ただし结果通常つうじょうれいじん失望しつぼう
  • ざい效果こうかさい单下やめ指定していこう效果こうかてきにんなんみちようしょう它们保留ほりゅう为矢りょう,您可能かのうただ需要じゅよう撤消此效果こうか
  • Illustrator まこと许用户以三种方式将渐变应用到笔画:ざい笔画ない渐变、沿笔画渐变またが笔画渐变。 しか而,ただゆうだいいち个,そく笔画ないてき渐变,よしとうこうてき SVG だい支持しじとう图像以 SVG 格式かくしき保存ほぞん时,にんなん包含ほうがん沿着あるまたがえつ它们てき渐变てき笔划はた转换为光栅。

这些ただ导致插画そうが师在需要じゅようりょう生成せいせいこう栅的いち些示れい。 这些みちえつ简单,插画そうが师就こしゆう可能かのうはた它们保留ほりゅう为矢りょう

ゆう关如なん检查 MediaWiki てき SVG ぶんけんてきさらしんいき,请参阅 § SVG ぶんけんざい MediaWiki ちゅうてき工作こうさく原理げんり

ぶん声明せいめい

<?xml version="1.0" encoding="UTF-8"?>
<svg
 xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink"
 version="1.1"
 viewBox="0 0 400 300"
>

まい个 SVG ぶんけんてきみなもとだい应该?以 XML 处理指令しれい开头。[8] XML处理指令しれい指定していXMLてき版本はんぽん和字わじしゅう[9] W3C坚持编码声明せいめい应该?使用しよう,[10]万维网联盟的验证器 ただ对不存在そんざい这种じょう提出ていしゅつ警告けいこく)。 创建ある编辑 SVG ぶんけんてき软件应提供ていきょう选择编码てき选项。 UTF-8 こく际化てき推荐?,而不 UTF-8 以外いがいてき ANSI ある Unicode 编码。 とうざい浏览ちゅう开维もと媒体ばいたいふく务器じょうてき SVG げんぶんけん时,かけしょう XML 声明せいめいはた导致轻微てき混淆こんこうはた显示原始げんし XML だい码而渲染なり图像。 如果您将げん SVG ぶんけん载到您的设备并在本地ほんじ开它,这不问题。

需要じゅよう带有 DTD てき DOCTYPE 声明せいめいかんかたけん使用しよう DTD,[5] ただし也不けん议不よう使用しよう DTD。 SVG 1.0 SVG 1.1 ゆう DTD 规范,ただし SVG 2.0 ぼつゆう。 SVG DTD はた验证 SVG,ただし DTD 不知ふちどうにんなん扩展。 よし此,DTD 验证かいはた RDF もとすうすえ以及 Inkscape 包含ほうがんざい其 SVG 输出ちゅうてき附加ふか元素げんそ属性ぞくせいれつ为错误。 维基媒体ばいたいふく务器还限せい DTD てき内部ないぶ集中しゅうちゅう包含ほうがんてき内容ないよういん此不さい可能かのう扩展 SVG DTD 以包含其元素げんそ属性ぞくせい

svg 根元ねもともと应该跟在きさきめん。 它必须?为 SVG 指定してい XML 命名めいめいそらxmlns="http://www.w3.org/2000/svg";[11] 如果ぼつゆう SVG 命名めいめいそら间,SVG 图像はたかいてい现。 (だま名称めいしょうそら间由 xmlns 指定してい。)其他名称めいしょうそら可能かのう包含ほうがんざい svg 元素げんそちゅうれい如,如果ぶんけん使用しよう链接,[12] 么应该声明せいめいxlink 命名めいめいそらxmlns:xlink="http://www.w3.org/1999/xlink"包含ほうがん SVG version 编号应该?通常つうじょう为 1.1)。 软件通常つうじょう提供ていきょう这些名称めいしょうそら声明せいめい,并且可能かのう包括ほうかつ其他名称めいしょうそら间。

width height 属性ぞくせいてきだま认值 "100%",这些默认值はたまこと许自动缩放。 指定してい width="400px" てき图像声明せいめい希望きぼう以 400 ぞう素的すてき大小だいしょう显示,而不せい齐地はまたかし其容不幸ふこうてき,许多软件工具こうぐ为这些属せい指定していりょう固定こてい大小だいしょうsvg 元素げんそ应该指定していいちviewBox[13] 属性ぞくせい。 视图かまち指定してい图像てき显示部分ぶぶん; 视图かまちたいらうつり缩放以适あい容器ようきてき宽度高度こうど

くらい

SVGぶんけんちゅうてき图图ぞうかいゆう一些有价值的用途,注解ちゅうかいあきらへんれい如,ざい解剖かいぼう图照へんちゅう标注部位ぶい)。しか而,SVGぶんけんちゅう多数たすう图都ぼつゆう必要ひつよう使用しよう以重ある转为りょう图将其换掉。如果于某种原因げんいん图是さいこのみてきかい决方あん就应とうしょう包含ほうがんざいSVGぶんけんちゅうただし,如果生成せいせいてきりょう图总たいじょうさらこうあるさら有意ゆうい义,则应はた其重しん绘制为矢りょう图。而且,其他浏览到这张图像てきどもとおる资源编者可能かのうかい决定给包含ほうがん受欢むかえてきもと于栅かく元素げんそてきSVG图像添上そえかみ{{BadSVG}}标记。

ざいSVGぶんけんちゅう使用しよう图时还需三思さんし以考虑将它们转换あるものおも为矢りょう图再はた它们あい并到图像ちゅう,而非直接ちょくせつはたくらい图包含其ちゅうざい讨论页进一步讨论这个话题。如果你决てい使用しよう图图ぞう,请确使用しよう嵌入かんにゅう”而非“链接”图像,いや则其はた无法渲染。

动画

SVG图像也可以动ただしよし维基媒体ばいたい项目ちゅう,SVG转化为PNG栅格格式かくしき使用しよういん此只ゆう浏览载了SVGぶんけんきさきざいかいゆう动画效果こうかざい条目じょうもく页面ちゅう需要じゅよう单击图像いたFile:页面,さいてん开图へん以加载SVG。

ざい过去,让SVG具有ぐゆう动画效果こうかてき方法ほうほう使用しようSMIL。最近さいきん,CS也支持しじりょう动画效果こうか

かく浏览对SMILてき支持しじただしざい不断ふだん减少。Internet Explorer支持しじSMIL;2015ねんたにさい推荐使用しよう,并有可能かのうざい未来みらいはた其从Google Chrome浏览ちゅう完全かんぜん删除。[14]截至2018ねん7がつじょりょうInternet Explorer、EdgeOpera,多数たすう浏览ひとし支持しじSVG SMIL动画。[15]

まいり§ 标记SVGぶんけん一节了解如何标记有动画效果的SVGぶんけん

标题

The title element right under the SVG element serves as the title name of the SVG image itself, but it can be also applied further inside of the descendant elements within the SVG image. Most modern desktop browsers render these titles into popup tooltips which help readers to identify the meaning of the object on mouse-hover even if there is text label by the object.

Similarly, title can also be applied on text too for collapsing message but it may be a good idea to give some hint of the existence of the title element by using text decoration like underline. XML comment is more suitable for technical information which should not be displayed to the reader normally but other users who may edit the SVG source code.

Currently most mobile browsers can not display any title content innately except for the one right under the SVG element because there is no equivalent of hovering the pointer on mobile devices.

<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="0 0 50 50">
	<title><span lang="en" dir="ltr" class="mw-content-ltr">Title of the whole SVG image</span></title>
	<g id="shapes">
		<title><span lang="en" dir="ltr" class="mw-content-ltr">Title of the "shapes" group</span></title>
		<rect x="0" y="0" width="10" height="20" fill="#f00">
			<title><span lang="en" dir="ltr" class="mw-content-ltr">Title of the rectangle</span></title><!--XML comment-->
		</rect>
		<circle cx="5" cy="5" r="3" fill="#0f0"/>
		<text x="2" y="30" text-decoration="underline"><span lang="en" dir="ltr" class="mw-content-ltr">Text</span>
			<title><span lang="en" dir="ltr" class="mw-content-ltr">Title of the text</span></title>
		</text>
	</g>
</svg>

きんようてき元素げんそあずか脚本きゃくほん

于安ぜん原因げんいんMediaWiki并不接受せつじゅSVGぶんけんないはま以下いかてきしき

<!--not whitelisted namespaces-->
xmlns:d="http://www.w3.org/2000/02/svg/testsuite/description/"
xmlns="http://www.w3.org/1999/xhtml"
xmlns="http://www.example.org/notsvg"
xmlns="http://example.org/notsvg"
xmlns:bd="http://example.org/ExampleBusinessData"
<!--no external content-->
xlink:href="../resources/SVGFreeSans.svg#ascii"
xlink:href="animate-elem-09-t.svg"
xlink:href="url(#testPattern)"
<image xlink:href="http://example.org/image.jpg"/>
<d:testDescription href="http://www.w3.org/TR/SVG11/styling.html#StylingWithCSS">
<image xlink:href="data:image/svg+xml;base64,"/>
<!-- attributeName -->
<set attributeName="xlink:href"/>
<animate attributeName="xlink:href"/>
<set xlink:href='#s'/>
<set attributeName='xlink:href'/>
<!-- css -->
@import
url("../images/selector-types-visibility-hidden.css")
url(woffs/embeded-text-text-05.woff)
<!-- scipts -->
<script></script>
<!-- interactive -->
onactivate=""
onbegin=""
onclick=""
onend=""
onfocusin=""
onfocusout=""
onload=""
onmousedown=""
onmousemove=""
onmouseout=""
onmouseover=""
onmouseup=""

To sanitize problematic svg-files, you can use https://svgworkaroundbot.toolforge.org/ (enable sanitize potentially dangerous commands), more details can be found at User:JoKalliauer/IllegalSVGPattern.

Due to limited abilities, the XML-Parser does not recognize and block the following patterns:

<!--ATTLIST-->
<!DOCTYPE svg [
<!ATTLIST bar id ID #REQUIRED>
]>
<!--ENTITY with more than one element-->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd" [
  <!ENTITY Smile "
    <rect x='.5' y='.5' width='29' height='39' fill='black' stroke='orange' stroke-width='2'/>
    <g transform='translate(0, 5)'>
      <circle cx='15' cy='15' r='10' fill='yellow'/>
      <circle cx='12' cy='12' r='1.5' fill='black'/>
      <circle cx='17' cy='12' r='1.5' fill='black'/>
      <path d='M 10 19 L 15 23 20 19' stroke='black' stroke-width='2'/>
    </g>
  ">
  <!ENTITY Viewport1 "<rect x='.5' y='.5' width='49' height='29' fill='none' stroke='blue'/>">
  <!ENTITY Viewport2 "<rect x='.5' y='.5' width='29' height='59' fill='none' stroke='blue'/>">
]>

外部がいぶぶんけん

ざい保存ほぞんSVG图片てきさい版本はんぽんまえ,你应とううつりじょ对用于制作せいさくSVGてき其他ぶんけんてき所有しょゆう引用いんよう(这就“链接”てき含义);如果这些引用いんよう遗留ざいSVGぶん本中ほんなか,渲染时会いん为找いた外部がいぶぶんけん而失败。维基媒体ばいたいへい蔽了此类じょう传,いん此无ほうさいうえ传它们。

せいさとし

删除あるきよしそら所有しょゆう使用しようてきてい义(def)也是错的そうほういん为它们会无谓增加ぞうかぶんけんたい积(じょ进一步的编辑还将用到它们,れい如作为底ばん)。

ゆう三个通用的优化程序:scoursvgcleanersvgoただし注意ちゅうい,这三个优化程序都有许多打开的错误,并且さい积极开发,它们てき使用しよう方法ほうほう请见《使用しよう优化ほどじょ

ただし注意ちゅういしん理工りこうさく具有ぐゆうそう议的,且通常つうじょうしょ希望きぼうてきまいり见《什么时候优化/验证ぶんけんしょ希望きぼうてき》获得さら细节与原よはらいんきよしある验证并不能ふのう证明おもしんうえ传是合理ごうりてき[16]ごう规范てき元素げんそ属性ぞくせい通常つうじょう是正ぜせい确渲しみてき必要ひつよう条件じょうけんいん此不应删じょ[17]

纯SVG、压缩てきSVG,通用つうよう规范

Inkscape其他ほどじょ也允许用户将ぶんけん保存ほぞん为SVGZ格式かくしき(压缩てき进制SVG)。该格しききょうとおる资源支持しじにんなんじょう传至此的图像应当さいよう。这类图像无法被はっぴじょう传。

注意ちゅういざいAdobe IllustratorInkscapeちゅう保存ほぞんぶんけんてき选项不同ふどうまいりHelp:Inkscape#Inkscape_SVG_vs._Plain_SVGHelp:Illustrator#How_to_save_as_an_Illustrator_SVGざいInkscape中有ちゅううさん种可选的SVG格式かくしき:“Inkscape SVG”、“纯 SVG”かず“优化てき SVG”。わかようざいInkscapeちゅうさいつぎ编辑ぶんけん,Inkscape SVGてきさいけいぶんけん格式かくしきいや则诸如图层或网格类的しんいきはたうつりじょ,这类图像应当以{{Created with Inkscape|IMPORTANT=yes}}标记表面ひょうめん它们应当さい优化。纯SVGてき渲染效果こうかあずかInkscape SVGしょうどうただしぶんけんたい积要しょういち些。优化てきSVG使用しようりょうめい为scourてき优化ほどじょ,它可以进一步压缩文件体积,并为librsvgてきほら(如phab:T217990[18]提供ていきょうりょういち些解决方ほう

字体じたい文字もじ

Shortcut

维基媒体ばいたいふく务器上安かみやすそうてき诸多自由じゆう字体じたい使用しよう<text>标签らいてい现。你可以在もと维基じょうてき渲染样例ある原始げんしれつひょうちゅう找到它们。ただしこれWeb字体じたい完全かんぜん支持しじ。一些字体的常规字形不可用,而只支持しじくろたいある其他(如斜体しゃたい);以考虑使用しようがえだい字体じたいLiberationちゅう适用于中ぶん)。请考虑使用しよう这些字体じたい而非はた文字もじ转化为路みち原因げんいん如下:

  • 保存ほぞん字体じたい而非みち文字もじ显著くだひくぶんけん总体大小だいしょうゆう其在图像ちゅう包含ほうがん大量たいりょうぶんほんてきじょう况下。
  • 其他编者以无需重绘全ぶんほんそく修正しゅうせい图像ちゅうてき文字もじある语法错误。
  • ぶんほん轻松こぼしなり其他语言,はぶけ贡献しゃ本地ほんじてき时候さいつぎ放置ほうち所有しょゆうてきぶんほん标签てきあさ烦,这是很重要じゅうようてきひん质,いん为维もとどもとおる资源一个多语言项目。みちみち文字もじ需要じゅようさらてきこぼし工作こうさく。另见Template:Translate
  • ぶんほんえき于被搜索そうさく引擎找到,而路みち轮廓文字もじ可能かのう无法きさきしゃ识别。

此外,如果字体じたい转化为路みち文字もじわかぼつゆう接受せつじゅてき自由じゆう授权,则可能会のうかい现版权问题(れい如矢りょう图像为字体じたいてき衍生作品さくひん)。另见:WP:公有こうゆう領域りょういき#字体じたい

些不应当はた文字もじ转化为路みち图形てき图像可能かのうかい使用しよう{{Path text SVG}}标记,如要链接いち个SVGぶんけんてきぶんほんおさむあらためわが们一ちょく说的“ぶんほんある字体じたい”)あずかぶんほん不可ふかおさむあらためれい如基于路みちてき版本はんぽん使用しよう{{Vector text versions|…}}

Demonstration of the basic steps of preserving the text before converting to path in Inkscape so the text can remain selectable (when opened in real-time in browser) and searchable (by search engine like Google).

If you still insist converting text to path for reasons like the lack of support of textPath function or rare glyph which is not present in most typefaces, you should duplicate the raw text group to overlap the converted text and add the attribute fill-opacity="0" stroke-opacity="0" to this group in order to hide the raw text. This way the text in the original SVG file can still be searched, clicked and highlighted by readers manually. opacity="0" may lead to some misunderstanding because it will make the highlight invisible while still selectable. display="none" prevents readers from searching the text without accessing the source code.

Converting text to outline (path) before exporting SVG is particularly popular among Adobe Illustrator users because the vector graphic software does not convert text-align attribute to text-anchor and the fallback fonts on Wikimedia have different font metrics than the chosen font by the image contributor. This leads to incorrect text positioning and encourages users to ignore the benefits of maintaining raw text in the vector file.

<span id="Not_displayed_text_(Flowed_Text_bug)_">

ぶんほんのう显示(浮动文字もじBUG)

See also: § Line wrap

Inkscape supports a feature known as "Flowed Text" which automatically wraps text to fit into the bounds of a given text box. Unfortunately this feature is part of SVG Tiny 1.2, which nobody supports. Its usage will almost certainly result in compatibility problems.[19] On Wikipedia, a flowed text box does not render at all (phab:T43424 - depending on font size and color).

[20]

为避めんInkscapeちゅうてき这一问题:

  • さい简单てきかい决方ほうただよう单击而非拖动らい以Inkscapeてき文字もじ工具こうぐ创建ぶんほん。(あい较而ごと,按住并拖动鼠标来绘制ぶんほんかまち时,你这とくつげ诉Inkscape使用しよう“浮动ぶんほん”。)

过也ゆう一些简单的方式来解决这个问题:

  • 如果やめ经创たてりょう浮动ぶんほんかまち,你可以使用しよう文字もじ→转换为文字もじらいはた其转一般いっぱんてきぶんほん[21]。(ただしこれきさき请检查文ほん对齐,ざい约15%てきあんれいちゅう[22],其转换了ぶんほんただしあらため变了文字もじ对齐[23]。)
  • 对于ただよし一行文字组成的浮动文本(ちょう过九なりてきあんれつ),你可以使用しようにんなんぶんほん编辑はた浮动区域くいきがえ换为<text x=".." y="..">标签(矩形くけいてきx、yすわ标),从而はた其转为简单的ぶんほん生成せいせいあずかInkscape完全かんぜんしょうどうてき效果こうか)。ざいUser:JoKalliauer/RepairFlowRoot#replace_the_flow-text_by_<text>_using_(Text-Editor)你也以找いた动字くし编辑脚本きゃくほん[24]帮你完成かんせい这一工作こうさく

如果你意がい创建りょうそらてき浮动ぶんほんかまちれい如未包含ほうがんぶんほんてき),其在Inkscapeちゅう无法いたある选中,ただしざい维基百科中仍会显示为一个黑色矩形。如要删除它,ゆういち可能かのうてき方式ほうしき

  • 使用しようInkscapeないけんてきXML编辑(编辑 → XML 编辑)删除所有しょゆうてき浮动ぶんほんかまち(树形视图ちゅう所有しょゆうめい<svg:flowRoot id="flowRootXXXX">てき节点)。
  • 使用しよう简单てきぶんほん编辑(如Notepad)搜索そうさく文字もじ"flowRoot"つう过移じょXML开始标签(<flowRoot ...>)、结束标签(</flowRoot>)以及对应两个标签间的所有しょゆうぶんほんらい删除浮动ぶんほんかまち[25]
  • 如果ただ隐藏不可ふか见的矩形くけい,你可以添加てんか fill-opacity="0"[26][27]いた<rect … fill-opacity="0"/>标签(ある<path d="…" fill-opacity="0">标签)ちゅう

ぶんほん转换げんせい

SVG原始げんしぶんほん渲染あずか转换为路みちぶんほんてき

Font scaling currently does not work as expected if horizontal and vertical scales (according to the effective transform matrix) are not equal (the horizontal stretch will be ignored: only the font height, computed from the matrix is currently honored); this can prevent the correct rendering in narrow/condensed or width-extended styles from another font, with text taking unexpected width and flowing out of the expected box (the alternative is to select an alternate free font family which is already narrowed/condensed).

Text is guaranteed to be misplaced (and in some case, ugly kerning) if the resolution of the PNG render is not the same as the native dimension defined by the SVG file itself regardless of how "regular" the scaling multiplier is (e.g. 0.5, 2 or 4) (phab:T36947).[28] In any case, do not use extremely small (>10px) or large font-size and then scale the text or the whole image to your desirable size. Always begin with a reasonable font-size (unfortunately a size around 80px is preferable).[29]

Beware also with font metrics differences: an SVG file may look good when rendered directly in a SVG-capable (all modern) browser under Windows or Mac OS (which can use common, but non free fonts such as Courier or Courier New), but will look other when restricted to the list of free fonts currently supported by the MediaWiki’s SVG-to-PNG renderer (or when viewed under OSes like free distributions of Linux), see also section "Font substitution and fallback fonts".

The attribute textLength isn't fully supported and could not rendered correctly. See phab:T15387.[30]

书写しきげんせい

ちゅうぶん图表可能かのう适合从上いたしたてき书写しきただしこと实上使用しよう特定とくてい字体じたい时这样会现异つね……

RSVG认可书写しきwriting-mode属性ぞくせいただし无法せい确显しめせ。对属せい给定にんなんだま认值(じょりょう从左こうみぎそとにんなん书写しき),とう使用しようぼう字体じたい渲染时,所有しょゆう都会とかいうずたかいたいち块(phab:T65236)。れい如,生成せいせい垂直すいちょくぶんほんてき常用じょうよう方法ほうほう就不おこり作用さよう

<text x="50" y="50" writing-mode="tb-lr" font-size="15px">ひがし涌綫</text>

如果确实需要じゅようがえだいてき书写しきれい如亚しゅう语言てき从上いたしもしき),请单どく对齐所有しょゆう,而不要ふよう使用しよう这个属性ぞくせい


字体じたいがえ换和备用字体じたい

How the fallback-fonts are rendered.

SVG font specifications may use a specific font family such as Arial or Times New Roman. Such a font specification usually means the user agent must have access to the font file with that name. Unfortunately, many fonts are proprietary and are not available on all operating systems. For example, not all operating systems have the proprietary Arial font. If the specific font family is not available, then some default font will be used; the default font may have a much different appearance. For the user agent librsvg, the default font is Liberation Serif.

Many user agents have a font substitution table that allows the user agent to substitute a font family that is close. To improve the font matching, SVG allows the font-family to be a list of font family names; the user agent will use the first font family that it recognizes. The graphic artist might list similar Microsoft, Apple, and Unix fonts to improve the chance of the user agent having the desired font. Additionally, SVG supports the CSS generic font family specification.[31][32] That means most SVG user agents should support the generic font families of serif, sans-serif, cursive, fantasy, and monospace. It is good practice to use a generic font family as the last entry in the font family list. For the librsvg on Commons:

  • sans-serif maps to DejaVu Sans
  • serif maps to DejaVu Serif
  • cursive maps to the uninteresting DejaVu Sans
  • fantasy maps to the uninteresting DejaVu Sans
  • monospace maps to DejaVu Sans Mono

On Commons, librsvg has the fonts listed in m:SVG fonts#Latin (basic) fonts comparison. Using just those fonts will get good results in Wikipedia articles that display their images using librsvg, but graphic artists should also be aware that SVG files may be displayed by other user agents. Consequently, it is best to use common font families (such as Arial) or a list of font families that ends with a generic font family (such as Trebuchet, sans-serif).

The font metrics for generic font families such as sans-serif will likely vary widely on different user agents. In graphic illustrations metric exact text elements are often important and Arial can be seen as de-facto standard for such a feature. Adding both Arial and sans-serif as fallback fonts will help the SVG to be displayed with best effort on machines that do not have or substitute Arial. To make the SVG file independent of Arial, change all occurrences of font-family: Arial to font-family: 'Liberation Sans', Arial, sans-serif.

If you are using non-Western characters, you should define those typefaces preceding Liberation Sans. For example, if your text contains Chinese characters, font-family definition should be: ‘ Liberation Sans, Arial, WenQuanYi Zen Hei, SimHei, sans-serif’. In this case, western fonts are put in the front because the quality of Western characters in Chinese fonts is often low, and we want to use the higher-quality ones first.

  • Inkscape begins supporting fallback fonts from version 0.91.
  • Adobe Illustrator version 18.1.1 or earlier (probably in later versions as well) does not support fallback fonts, so the SVG file has to be manually updated in a text editor after it is saved.
desired font Wiki-fallback possible fallback definition that will look similar
(works on Wikimedia/Windows/Linux/Mac)
[-no definition-] Liberation Serif
serif DejaVu Serif[33] font-family="serif"
Times New Roman Liberation Serif font-family="Liberation Serif,Times New Roman,Times,Times-Roman,serif"
sans-serif DejaVu Sans[33] font-family="sans-serif"
Arial Liberation Sans font-family="Liberation Sans,Arial,Nimbus Sans L,Helvetica,sans-serif"
Helvetica Nimbus Sans L font-family="Nimbus Sans L,Ubuntu,Liberation Sans,Helvetica,Arial,sans-serif"
Calibri font-family="Liberation Sans,Carlito,Calibri,Segoe UI,Myriad,UnDotum,Optima,Tahoma,Arial,sans-serif"
monospace DejaVu Sans Mono font-family="monospace"
Courier New Liberation Mono font-family="Liberation Mono,Courier New,Courier,monospace"
[-everything unknown-] DejaVu Sans


Layout with text and tspan elements

Although you can use only the text element to render simple text in the image, the tspan element can be useful to handle text which the position of the word is dependent to the other.[34] A tspan element must be nested within the text element, and then more tspan can be nested within this tspan, all styling defined in the parent text element will be inherited by its child tspan elements. For example:

<g font-size="12px">
  <text font-weight="bold" x="10" y="10"><span lang="en" dir="ltr" class="mw-content-ltr">Wikipedia hosts knowledge</span>
    <tspan fill="blue"> <div lang="en" dir="ltr" class="mw-content-ltr">
contributed
      <tspan text-anchor="end" dy="12"> by volunteers</tspan>
</div>
    </tspan>
  </text>
  <text font-style="italic" x="15" y="30"><span lang="en" dir="ltr" class="mw-content-ltr">Wikimedia Commons hosts free media files for all sister projects.</span></text>
</g>

The primarily difference with the "g nesting text" structure is that few important text layout behaviors are exclusive to tspan: When multiple text elements are lined up consecutively, they still position themselves independently; if multiple tspan elements are lined up consecutively but the second and subsequent tspan elements are not given absolute x coordinate, text of these tspan elements will line up horizontally right next to the end of the character of prior tspan in the same text element.

However, tspan should be used sparingly even if you define the absolute x coordinate for every single tspan element in the text element. This is because under the default xml:space definition, any line break (within text or tspan) with an extra trailing white-space is converted to a blank space character automatically.[35] If there happens to be multiple consecutive line breaks, they are treated as one space still. This would not be a problem if the line break is followed by a tspan element with absolute x coordinate and is align to left (text-anchor=start, the default value). If xml:space is given the 'preserve' value, librsvg will translate the indent to a long white tab character equal to 8 space characters. Because the auto-formatting or re-indentation (indent style) of most XML editors creates indent for every new descendant XML tag automatically, use re-indentation carefully if your SVG file contains such usage of tspan.

The behaviors in different SVG renderers to this issue varies much and is usually inconsistent to the W3C specification (also the 'preserve' value of xml:space will be deprecated in SVG 2.[36]). The only problem with librsvg is that it never converts the line break alone into space no matter which value of xml:space is given if there is no trailing space or indent before the tspan tag. Except for librsvg, nearly all modern browsers always add the converted space character right after the preceding text, this is the reason why the end or middle values of text-anchor property always align the text 1 space leftward because the new line and/or the trailing tab or space after the closing tspan tag is converted to an unexpected space character.[37]

Re-indentation XML Code Result
Before
<text>
  <tspan>O</tspan><tspan>n</tspan><tspan>e</tspan>
</text>
One
After
<text>
  <tspan>O</tspan>
  <tspan>n</tspan>
  <tspan>e</tspan>
</text>
O n e

Inkscape is buggy to render tspan, for example, inheriting text-anchor property from the first tspan element incorrectly for the subsequent tspan elements even if the property is specifically given a value in all tspan elements.[38] In such case, simply revert the "text nestling tspan" structure to just "g nestling text". Inkscape also defaults to xml:space="preserve" to deal with space between tspan. If you are completely concern with how your SVG appears in Inkscape but prefer the default xml:space handling, use &#160; to replace each general space so it will not be hidden in Inkscape.

If you are generating an SVG using Adobe Illustrator, you will be given options to "Output fewer <tspan> elements" and "Use <textPath> element for Text on Path" during the save dialog. To maximize the consistency of the appearance of your font across browser platforms, you should place a check mark next to the former and make sure there is no check mark next to the latter. If you do not do this, the kerning of some of your letters may cause them to overlap (depending on your browser).

动换ぎょう

SVG 1.1 提供ていきょうにんなん形式けいしきてき动换ぎょう(无论软回车还かたかい车)。所有しょゆうてき动换あるき需要じゅようしゅ动重しん放置ほうちtextあるtspan元素げんそ,x绝对坐标不变,さら换新てきyすわ标。对于tspan元素げんそ以用dy属性ぞくせい设置いちぎょうてきyすわ标。虽然textPath也可以处しょうどうまとじょう况,[39]ただし其未librsvg/维基媒体ばいたい支持しじphab:T11420)。

SVG 1.2 てき一份草案确实解决了自动换行问题,ただし此方こちらあん很少受到支持しじ

SVG 2.0 草案そうあん也解决了动换ぎょうてき问题,ただし截至2018ねん5がつ,Chrome、Firefox、Edge浏览librsvgひさし支持しじ

Font styling class

Usually it is simply gratuitous use of the ‘style attribute’. To ease the process of updating font-family for every text or tspan elements, you can define the font CSS class(es) within ‘style element’ and apply the class property in elements like this:

<style type="text/css">
text {font-size:12px; font-family:Liberation Sans, Arial, sans-serif} <!-- <span lang="en" dir="ltr" class="mw-content-ltr">General font styling</span> -->
.small {font-size:9px}
.special {fill:#f93500; font-weight:bold}
.title {font-size:14px; font-weight:bold; font-family:Liberation Serif, Times New Roman, serif}
.italic {font-style:italic}
</style>
<text class="title" x="10" y="20">Qridfs</text>
<text x="10" y="30">Rfnkl fgkj qljf fgk gskla</text>
<text class="small">
  <tspan x="15" y="40">Dfj fdmnkl</tspan>
  <tspan x="15" dy="12" class="italic">Akgfld fkdngf mna</tspan>
</text>
<text class="special" x="10" y="60">Tcjgh xlij qpfj</text>

CSS class defined in ‘style element’ can also be used for other SVG elements (e.g. g and path) despite the misleading type="text/css" attribute. Even if one particular style is defined once in the SVG, it is still advised to replace the style with class for a tidier layout of XML codes.

Contrary to popular belief the style attribute does not separate content from presentation, and unless you need to override properties set by a CSS selector, it is best to use the SVG formatting attributes instead (e.g. <path fill="#fff" stroke="none"/> instead of <path style="fill:#fff;stroke:none"/>).[40] However, if you need to override the element style defined in style element, you do need to employ style attribute. If you need to override the style for text element without style attribute, you can use a tspan element container to nest the text you need to override the style, presuming there is nothing predefined in style element for tspan element.

Note
  • phab:T68672 – CSS style element get ignored if the default value type="text/css" is omitted.
  • phab:T43423 – CSS child selectors are not supported by librsvg.
  • phab:T68551 – CSS classes on text elements get not inherited on child tspan elements. If you want this, you need to add a separate class for tspan as well, or use simply groups (but not in the text element as it Scour unfortunately does).

Text with background edge

Sometimes the text might be unreadable because the background color has low contrast with the font color or the pattern is too complicated that confuses the reader. This can be solved by duplicating the text in exactly the same position, but the back text rendered with stroke and the fore text without it like this:

<text style="font-size:12px">
  <tspan x="10" y="20" style="stroke:white; stroke-width:3px; stroke-linejoin:round;"><span lang="en" dir="ltr" class="mw-content-ltr">Placeholder</span></tspan>
  <tspan x="10" y="20"><span lang="en" dir="ltr" class="mw-content-ltr">Placeholder</span></tspan>
</text>
  • "stroke-linejoin:round" is defined to avoid sharp corner of the text stroke.

The problem with applying stroke and fill to the same text element is that the stroke will be rendered over the main body of text, making it otherwise unreadable if the font is too small but requires a larger stroke to be distinguishable from the background.

SVG filters can be used to draw the text over a dilated version of the text. The filter first expands the text, sets the color of the expanded text, and then draws the original text over the dilated version. One filter can be defined, and that filter can be used by several text blocks:

<filter id="textBack">
  <feMorphology in="SourceAlpha" operator="dilate" radius="1" result="bloom" />
  <feFlood flood-color="white" flood-opacity="1" result="flback"/>
  <feComposite in="flback" in2="bloom" operator="in" result="surround" />
  <feMerge>
    <feMergeNode in="surround" />
    <feMergeNode in="SourceGraphic" />
  </feMerge>
</filter>
<text x="10" y="50" filter="url(#textBack)">gibberish</text>
<text x="10" y="70" filter="url(#textBack)">more gibberish</text>

SVG filters can also be used to size an opaque rectangular background that surrounds the text. Using a filter is more robust than painting a rectangle and then painting the text on top of that rectangle. A fixed-size rectangle may not fit the font used for the text; the size of the rectangle would also need adjustment if the text changes. If the text is translated, for example, the rectangle may need to be changed. Using a filter automatically adjusts the size.

<filter id="rectBack" x="-2%" y="0%" width="104%" height="100%">
  <feFlood flood-color="white" flood-opacity="1" result="rect"/>
  <feMerge>
    <feMergeNode in="rect" />
    <feMergeNode in="SourceGraphic" />
  </feMerge>
</filter>
<text x="10" y="50" filter="url(#rectBack)">gibberish</text>
<text x="10" y="70" filter="url(#rectBack)">more gibberish</text>

Outlining text can be done without filters by explicitly rendering the text twice. The first time, the text is rendered with a white stroke to set the outline. The white outline erodes the text. The text is rendered a second time, but this time the text is not stroked. Consequently, the characters are rendered full size (without erosion).

If you have lot of text that needs to be rendered with a stroke background, you can manually include the text within <g>, <text> and <tspan> elements. The <g> element which will be rendered underneath, apply the stroke, then <use> the text group of <text> element without a stroke and fill the font with contrasting color:

<g style="stroke:white; stroke-width:3px; stroke-linejoin:round">
  <text id="text_group" style="font-size:12px">
    <tspan x="10" y="80"><span lang="en" dir="ltr" class="mw-content-ltr">Placeholder 1</span></tspan>
    <tspan x="10" y="95"><span lang="en" dir="ltr" class="mw-content-ltr">Placeholder 2</span></tspan>
  </text>
</g>
<use xlink:href="#text_group" style="fill:black; stroke:none"/>

W3C includes paint-order property in SVG 2.0 which allows the order to render the attributes of "fill", "stroke" and "markers" within one element arranged by the user manually, instead of following the default mandatory order.[41]

Mozilla Firefox also includes this attribute experimentally but it defaults to disable in the stable release until SVG 2.0 matures. This feature can be enabled in the about:config entries of Firefox.[42]

渐变しょく

きつね浏览のうせい确渲しみてきいち个样れい

Users of Inkscape version 0.46 may notice that images with "Fill gradients" display perfectly on Inkscape, but display "messed up" in Opera or Firefox browsers. One possible cause is that the last "stop" on a gradient has opacity set to 0. Inkscape appears to ignore this last stop, but both Firefox 3.0.6 and Opera 9.36 will render it as a white border in the filled object. Solutions are either remove the last stop (because it was probably created in error) or change the opacity (and colour) so that the image renders correctly in browsers.

Note that Inkscape adds a JavaScript polyfill to SVG images containing mesh gradients. Scripted SVG images cannot be uploaded to Wikimedia Commons, but removing the JavaScript code will break the gradients.

Users of Adobe Illustrator CS5, CS6, or CC and who also use Firefox may notice that an Illustrator "symbol" containing a gradient will render normally as a Commons PNG file but if the SVG file itself is opened in Firefox these symbols will appear vacant. Other browsers will have no difficulty— Google Chrome, even Internet Explorer will render Illustrator’s SVG symbol gradients correctly, but because of a known bug that the designers of Firefox have been aware of since 2005 (Mozilla’s Bugzilla bug 376027 and other reports that lead to it such as bug 353575) but have so far failed to adequately fix, Firefox will display such symbols as empty shapes (symbol strokes and symbol paths without gradients are unaffected).

Adobe Illustrator users should also note that any Illustrator "symbols" containing paths with both a gradient and a filter will be rendered as a PNG in Commons only within the first instance of the use of that symbol. Subsequent use of a symbol containing these paths will render the paths (though not the entire symbol) as blank (neither gradient nor filter nor fill nor stroke will be applied).

Blurring

Comparison of gaussian blur filter effect between Google Chrome and Wikimedia. (Source SVG file)

Wikimedia’s SVG renderer currently supports various filter effects, but some effects such as gaussian blur (feGaussianBlur) behave differently when the blurred object exceeds the edge of the actual image. The current version of RSVG will treat the cropped edge as the actual edge of the object to apply the effect (as if the object has applied clipPath before applying filter effect), creating an undesirable filter effect against the image edge.

ぶんけん尺寸しゃくすん

减小ぶんけんたい

如果ぶんけんふとしだい,请通过以下方かほうしきらい压缩、优化:

こぼし

SVGぶんけん直接ちょくせつこぼし译,也可以是语言嵌入かんにゅうしきこぼし译。さらしんいき请参见 Commons:Translation possible/了解りょうかいさらおお.

转换为SVG

See also: Commons:Media for cleanup

给出一个图像文件但格式不是SVG,ゆう种方ほうはた其转换为SVG,见§ 转换あきら节的ほどじょ

ちゅう对于よしだい三方进行矢量化的矢量图像,存在そんざいいち个问题,そく哪怕しょ描述てき图像本身ほんみぼつゆうばん权或てい于原创性门槛,りょうだい自己じこ可能かのう拥有ばん权。さらしんいき请参见§ ばんいち节。

Generally, there are 3 ways to produce an SVG file, given an existing image:

  1. Regenerate it
  2. Convert it
  3. Create a new one

If you are unable to convert an image yourself, please add the tag {{Convert to SVG}} to flag that the image should be converted. Some images are not well-suited to SVG, notably continuous-tone images such as photographs. These generally should instead be stored as JPG.

Regenerate it

If the image was generated by a program (rather than drawn by hand) — for example, a chart from a spreadsheet — it may be possible to set the output format to SVG, rather than PNG or other format, and thus produce an SVG image from the same source. If possible, this is generally easiest.

Convert it

Many vector file formats can be easily converted to SVG simply by changing the format (repackaging the existing data), by using a converter program. This may be as simple as opening the file in a vector image editor and then saving it in SVG.

For raster (bitmap) graphics, this cannot be done because the image is a set of individual pixel values, not a set of strokes (vectors). For these images (notably PNG images), one can convert to SVG via "vectorization" or "tracing" — automatically generating a vector graphic from a raster image.

Many SVG editors have tracing functions, and dedicated converters exist. In Inkscape, this is done by the potrace program.[46][47] Concretely: open the bitmap (File → Open… (Ctrl-O)), then select Path → Trace Bitmap… (Shift-Alt-B). There are various options; after using, please delete the underlying bitmap, and consider simplifying the path to reduce the number of nodes (Ctrl-L).

Adobe Illustrator also allows for the conversion of bitmap images into vectors via its Image Trace function. Care must be taken when doing so that the resulting vector image is neither ponderously large (often the result of too much conversion fidelity with regard to color and shape) nor so simple that it loses faithfulness to the original image. Converted images almost always require some manual correction after conversion. As in Inkscape, the underlying bitmap should be removed after conversion is complete.

It should also be noted that when Illustrator converts one of its files into an SVG file, it tends to convert a number of shading effects such as "inner glow", "outer glow", and gradients applied along or across a path into undesirable raster images which it then embeds in the SVG image using links. Such embedded images can often be immediately detected by viewing the image in a web browser under high zoom where they will appear cloudy or have visibly jagged edges (neither of which is ever true of a correctly rendered vector image). As these effects were originally created without regard to the W3C consortium, Adobe does not offer and is never likely to have a solution to the problem.

In order to remove raster components from an Adobe Illustrator-generated SVG prior to uploading the image to Commons, the artist must first be able to identify where Illustrator has put them. This can be done in the following way:

First finish editing an image file and save in Illustrator’s AI format (*.AI), then save it again in SVG format. During the second Save dialogue, choose to "embed" the links (for now). Then close out the image (File=>Close or Ctrl+w). Next, open the SVG version back up again, click on "Window" from the right side of the top menu bar, and scroll down to "Links". This will open up a small window containing information about each of the links (if any) which currently exist in the SVG image (whether or not Illustrator produced them). You can click any of the entries in the top half of the window and then select the "Go to link" button located in about the middle of it-- this will take you to that particular raster so that you can identify it and either remove it or replace it with a non-raster based alternative.

Note that this SVG version of your image, when viewed in Illustrator, may look very different from the same SVG file you thought you had saved just a few minutes prior: this is because Illustrator has made a set of codes during the creation of that file which it then has difficulty reading (SVG is not an Illustrator-proprietary format, AI is, and so while Illustrator will never have difficulty correctly viewing an AI (Adobe Illustrator) file, it will sometimes struggle to correctly render an SVG, even one that it itself produced). Fortunately, even an SVG that looks confusing in Illustrator will usually at least appear to render correctly in most browsers (with the occasional and already noted exception of Firefox) and in Inkscape.

Create a new one

If an image cannot be regenerated or converted, the remaining option is to recreate it — draw a new SVG image, using the existing image as a model. This is manual and the most time-consuming option, but may ultimately yield the highest quality.

In all cases, it may prove useful to touch up the resulting image in an SVG editor — perhaps adding details which are hard or impossible to produce in the originating program, or simplifying or refining a complex conversion (such as simplifying a path described by 100 points to one described by 5 points, if extra points add unnecessary detail).

Once you have created an SVG image, upload it (under a new name), and tag the original raster image with {{Vector version available}}, but please do not delete the raster image or list it for deletion, as it still serves some purposes — see Commons:Superseded images policy for details.

うえ传与ぶん

うえ传至どもとおる资源てきまい个SVGぶんけん应展あかり它是如何いか制作せいさくてき使用しよう{{Inkscape}}{{Adobe}}{{HandSVG}}とうばん进行标记。
ざいうえ传文けんこれまえ你应とう检查其外观和有效ゆうこうせい使用しようきょうとおる资源SVG检查工具こうぐ查验
如果您不确定あるそうさき了解りょうかいlibrsvg如何いか渲染ぶんけん,请将其上传至Test.svg

图像描述

Make sure to fill out the {{Information}} box as fully as you can. Often, it’s a help when an image has a complete information box as this makes categorization by others easier and allows others to make translations.

See the § SVG software tags section for detailed information on a SVG media.

はたSVGぶんけん归类

All SVG graphics should be sorted into the appropriate subcategory or subcategories of Category:SVG files. Please do not place images directly in the parent category as it will become overcrowded and useless (we have thousands and thousands of more than 100,000 SVG files).

Sort subcategories which rely not on subject but on technical aspects ("created with…", "animated", "valid", and so on) by '*' to keep them outside the alphabet listing.

The SVG categories tree

The main tree is Category:SVG, as a part of Category:ImagesCategory:Media types.

Concerning the creation of topical subcategories, it is unnecessary to rebuild the complete hierarchy tree of Category:Topics. Normally, it is enough to gather some topics into one. For instance, Category:SVG colors could contain all color-related SVG files of Category:Colors, so it’s pointless to create Category:SVG red, Category:SVG blue and so on. Maybe some subcategories will become useful later, but stay close to the existing topics tree, and do not put any SVG files only into a SVG category: Categories are primarily for finding media, not for hiding them. Do not over-categorize.

Category naming conventions

Category names start with "SVG" followed by the topic in lowercase (unless it’s a proper noun). For example, a category containing SVG files related to chemistry would be called Category:SVG chemistry. There was no naming convention for a long time, thus you may see titles that do not match this format. These will be converted over time.

标记SVGぶんけん

まいりCategory:SVG marker templates了解りょうかい所有しょゆう可用かようてきSVG标记。
Transcluded from Commons:SVG marker templates

SVG software tags

You will find the complete up-to-date list at SVG created with ... templates
For the software used (Category:SVG graphics by software used):

 
This vector image was created with Adobe Illustrator.
 
This table was created with bin2svg.
 
This structural formula was created with ChemDraw.
 
This vector image was created with CorelDRAW.
 
This diagram was created with Dia.
 
This circuit diagram was created with the Electrical Symbols Library.
 
This vector image was created with Xfig and a Fig-to-SVG conversion tool.
 
This plot was created with Gnuplot.
 
The SVG code is valid.
 
This vector image was created with a text editor.
 
This vector image was created with Inkscape.
 
The SVG code is valid.
 
This vector image was created with Inkscape, and then manually edited
.
 
This vector image was created with MetaPost.
 
This vector image was created with Sodipodi.
 
This vector image was created with Scribus.
 
The SVG code is valid.
 
This vector image was created with a text editor.
 
This vector image was created with another SVG tool.
 
This vector image was created with an unknown SVG tool.
 
This vector image was created with Vim.
 
This vector image was extracted with Inkscape.


See #Software section for a list of programs.

SVG file tags

 
This image includes elements that have been taken or adapted from this file:
Example.svg.


Translate this file This SVG file contains embedded text that can be translated into your language, using any capable SVG editor, text editor or the SVG Translate tool. For more information see: About translating SVG files.

This file is translated using SVG <switch> elements. All translations are stored in the same file! Learn more.

For most Wikipedia projects, you can embed the file normally (without a lang parameter). The Wikipedia will use its language if the SVG file supports that language. For example, the German Wikipedia will use German if the SVG file has German. To embed this file in a particular language use the lang parameter with the appropriate language code, e.g. [[Help:SVG/zh|lang=en]] for the English version. Do not specify a lang parameter if it is not needed. The parameter may prevent the use of a subsequent translation.

To translate the text into your language, you can use the SVG Translate tool. Alternatively, you can download the file to your computer, add your translations using whatever software you're familiar with, and re-upload it with the same name. You will find help in Graphics Lab if you're not sure how to do this.


This image is an animated SVG file. The .png preview above created by RSVG for use in Wikimedia is not animated and may be incomplete or incorrect. To see the animation, open the original file. It should run in any modern browser or viewer. Recent versions of Chrome, Firefox, Microsoft Edge, Safari, and Opera all support SVG animated with SMIL. Other SVG animations can be found at Category:Animated SVG files.

Templates:Animated SVG/I18n
العربية  Boarisch  বাংলা  català  čeština  Deutsch  Deutsch (Sie-Form)  English  español  فارسی  suomi  français  galego  עברית  हिन्दी  magyar  հայերեն  íslenska  italiano  日本語にほんご  한국어  lietuvių  македонски  മലയാളം  Plattdüütsch  Nederlands  occitan  português  português do Brasil  русский  sicilianu  slovenščina  svenska  தமிழ்  ไทย  українська  ちゅうぶん  ちゅうぶん(简体)  ちゅうぶんしげるからだ  +/−

.


  • SVG files containing JavaScript cannot be uploaded at present, but this template anticipates that possibility {{Scripted SVG}}.




SVG conversion tags

All Ba images in this gallery could be re-created using vector graphics as SVG files. This has several advantages; see Commons:Media for cleanup for more information. If an SVG form of this image is available, please upload it and afterwards replace this template with {{vector version available|new image name}}.


All images in this gallery could be re-created using vector graphics as SVG animation files. This has several advantages; see Commons:Media for cleanup for more information. If an SVG form of this image is available, please upload it and afterwards replace this template with {{vector version available|new image name}}.

  • To indicate that you are currently working on a vector version of a raster image you can tag it with {{Vector wip|1=~~~|time=~~~~~}}.

  • For SVG files using embedded bitmaps causing bad quality, use {{BadSVG}} and for rasters that have been superseded by a SVG file, use {{vector version available|File name.svg}}



This file has been superseded by Example.svg. It is recommended to use the other file. Please note that deleting superseded images requires consent.
new file

Sorry, this SVG file is solely a source for re-utilization, editing or printing purposes. Please do not use this graphic within Wikipedia articles! MediaWiki isn't able to render this image correctly. Some details may be missing or look wrong. When you include the image in a Wikipedia or any other Wikimedia project site's page, you may want to use the other file, until the support increases.

Help:SVG/zh File:SMW Logo.SVG

Deutsch  English  español  italiano  日本語にほんご  한국어  македонски  português do Brasil  русский  sicilianu  slovenščina  简体ちゅうぶん  しげるたいちゅうぶん  +/−

{{{svgImageLabel}}}


{{{image alt}}} This SVG file is a generic template for creating new images. It contains embedded placeholder text using specific fonts that may not be available on Wikimedia Commons. This file is not intended to be embedded in a wiki page. Do not reupload this file with text converted to paths, even if the text appears unsightly in an image preview.
How to derive an image from this template
To create an image using this template:
  1. Download this SVG.
  2. Open the SVG in an SVG editor and change the wording and numbering.
  3. Convert all text to a path and save as a basic or plain SVG.
  4. Upload the new SVG to Wikimedia Commons.

SVG files in MediaWiki

How SVG files work in MediaWiki

When you upload your SVG to Commons (or any other MediaWiki wiki), the software automatically produces PNG thumbnails, embedded in the articles and the description page. If you download the image (usually by right mouse clicking on the image), you will get the PNG image. If you want the SVG file you must save the link to the image instead of the image itself. This works (by right mouse clicking on the link under the image) only on the description page of the image, not on the thumbnail in the category page.

MediaWiki uses librsvg to convert SVG files to PNG files for display (SVG rendering), it has some long and well-known bugs that should be fixed, so you might want to check your file with that program before uploading. You can test the SVG with SVG Check for accurate PNG render preview and W3 XML validator for possible code errors or incompatibility of SVG elements or attributes.

Further information: MediaWiki SVG limitations.

Scaling SVG files via MediaWiki

What this means: Say you want to produce a large version of your SVG for detailed maps, or using in-bitmap software like gimp, or calligraphy printed out one character per page, or something like that. You need to force MediaWiki to produce a huge PNG thumbnail, by using https://commons.wikimedia.org/w/thumb.php?f=Foo.svg&w=1000 or by doing something like [[File:Foo.svg|1000px]] in the sandbox or your talk page or somewhere else unimportant. Printing this giant PNG will look much better than if you try to scale up one of the default thumbnails! Of course, you can also use for-printing SVG software like Inkscape but sometimes that shows something other than what’s shown on-screen (black background, other fonts, etc.).

つね见问题

てきSVG图像选择什么尺寸しゃくすんさら合理ごうり
The absolute size of the document does not matter much, since that only affects how it is displayed when viewed by itself. The file size does not depend on the document dimensions. The image can be stretched or compressed as much as a user wants, without changing quality, or file size. With that in mind, the recommended image height is around 400–600 pixels. When a user views the full size image, a width of 600–800 pixels gives them a good close-up view, while still allowing them to fit the entire image on their screen without having to zoom in or out: while 9 × 9 pixels are too tiny, 3000 × 2000 are too large. The length of the shorter side of the PNG rendered by librsvg on Wikimedia is capped at 4096 px (i.e. if width is shorter than height, the length cap of 4096 px will be applied on the width and the height will be scaled accordingly, or vice versa), so there is no point to upload SVG image which requires that much of resolution to be readable when some of the text will be too tiny after scaling down to preview size. Smallest font in SVG image should be readable in 2000-px width at least, the largest recommended rendering resolution in the image description page. Otherwise, a raster version should be provided alongside the SVG source.
如何いかざいてき电脑じょうはたSVGぶんけん转换为光栅格しき
For SVG file which behaves incorrectly in graphic software such as Inkscape, you can simply upload the SVG to Wikimedia then save the link which provides PNG render in other widths in the file description page. You can adjust the number-px in the link to generate the desirable width of the PNG render. For image with any side larger than 4096 px, you may use any conversion tools such as RSVG-Convert with the only difference being the lack of anti-aliasing. If you want the raster image looks smoother, you may convert the SVG to PDF in RSVG-Convert then convert the PDF to raster version in Photoshop (Inkscape still presents some font problem when opening PDF). Another option without uploading SVG source to Wikimedia (due to non-free license) is to use the SVG preview on Wikimedia Toolforge which does not have the maximum side cap, although certain rendering results such as font may differ slightly.
为什么我てき图像のう渲染?
This might be due to a number of reasons. Most often it is due to a reference to an external file, a leftover from tracing a bitmap, perhaps. (The rendering stops as the website tries to find this other file) To solve this problem, in your editor, make sure to remove any references to other files before saving the final version. If it is necessary to use bitmaps you can use in Inkscape the function to embedding all images (Effects menu → Images → Embed All Images). It’s also possible that you use special effects like blurring. Unfortunately it’s currently not well supported by librsvg. See also § Plain SVG, compressed SVG, generic specifications hereinbefore.
わが以在哪里いた关于SVG图像てきさら帮助?
Try Commons:Graphic Lab if you have a problem with an individual image. Commons:Graphics village pump can be useful for SVG discussion (as well as graphics in general). Often SVG enthusiasts will be around on those pages, and are more than willing to help.
你是怎么ざいInkscapeちゅうおさむあらため图像尺寸しゃくすんてき
The document size starts out with an A4 page. To make this larger or smaller, create a rectangle with the dimensions you desire the document to be, and select it with the arrow tool. Then select File → Document Properties, and under Custom Size, choose Fit page to selection, and click OK. You can now delete the "sizing" rectangle, and move or resize the other elements to fit the space you have created.
ざいうえ传到维基どもとおる资源きさきてきぶんほん显示为一些小くろ块,あるもの根本こんぽん显示!
If you use "Flowed Text" in Inkscape, it will not render at all. Flowed text boxes are created when you click and drag to make you text box. To avoid this, just click once to position your cursor and then type your text. To convert a flowed text box to a normal text box, go to the "Text" menu and choose "Convert to Text".
If this still doesn't work, some text features of Inkscape are not supported by MediaWiki’s renderer, such as text-on-path. If you are not using flowed text and still have problem, convert the text to paths. Do this by selecting the command Path → Object to Path. This will convert the text to paths. Save as plain SVG, and reupload your file.
My arrowheads/dashed lines are appearing as little blocks, or aren't showing up at all after uploading to Commons!
Check that attribute style="overflow:visible" is in tag marker and not in tag path. Some stroke features of Inkscape are not supported by MediaWiki’s renderer. Select the offending objects, and select the command Path → Stroke to Path. This will convert the strokes to paths. Save as plain SVG, and reupload your file.
ぐういた透明とうめい背景はいけい怎么おさむ复?
Do you really need to? Usually not! MediaWiki’s renderer will convert the SVG file to PNG with a transparent white background for display (displays white if your browser doesn't support PNG transparencies). Browsers that natively support SVG transparency will show the background color through the image, white! (or grey if the image is displayed as a thumbnail). Leaving your image transparent behind helps future editors, and allows the image to be displayed over other background colors without a big white square. However, if your image really needs a specific colored background, create a rectangle the size of the image, fill it with the background color of your choice, and choose the command Object → Lower to Bottom. Save your image, and enjoy the solid background color![48]
てき字体じたい不能ふのう正常せいじょう渲染。ほん站点支持しじ渲染什么字体じたい
见元维基SVG字体じたいれつひょう
わが使用しようりょう维基どもとおる资源しょあんそうてきどう款字たいただしざいわがSVG图像ちゅうてきぶんほん定位ていい本地ほんじ渲染てきどもとおる资源渲染てきおこりらい仍然いち样。
It depends on which rendering library and version your local renderer is using. Text positioning and other SVG aspects (such as "transform") are known to behave differently in different rendering libraries. For closest result to Wikimedia render, you should use whatever renderer which uses librsvg. Opera, Chrome and Safari gives accurate results. Firefox and Internet Explorer 10 are slightly inaccurate. Safari looks neater when certain font smoothing is enabled.
I'm drawing a flag (or some other insignia) and it asks for PANTONE or CMYK colors. What do I do?
First, if you see the words*PANTONE or CMYK, try to see if they have something called RGB. Wikimedia Commons images are used a lot on Wikimedia projects such as Wikipedia, etc, and are designed for use on computer screens. If you can find RGB colors, use them in favour of others. If you can't, you can convert the colors using your program’s own color picker, or, in the case of PANTONE, Color Finder,[2] from which you can extract RGB values for a color code. Make sure to indicate (perhaps on the talk page or image summary) which method of conversion you used, like "[Some Program] was used to convert CMYK values […] to RGB […]".

软件

许多ほどじょ以处SVGぶんけん。您或许会そう尝试边给てきほどじょ过可ようてき并非ただゆう这些ほどじょ。其中一些可以免费下载,另一些则是商业软件。

いん为SVGただいち个XML规范,所以ゆえん使用しようぶんほん编辑あるもの自己じこてきほどじょ/脚本きゃくほんしゅ动编うつしSVGぶんけん[49]こと实上,许多SVG图像ようぶんほん编辑うつしなりてき。一个可以高亮显示语法的编辑器将会对你很有帮助。使用しようW3C SVG 验证らい检查你的作品さくひん

阅览

如今所有しょゆうてきWeb浏览以在ほんつくえ渲染SVG。

  • librsvgいち个MediaWiki使用しようてき渲染库,以及れつ阅览
    • RSVG-view for UNIX,一个小而简单的阅览器,以预览MediaWiki渲染てきSVGぶんけんがい
    • RSVG-view for Windows同上どうじょう
    • Commons:Commons SVG Checker,另一款基于基于librsvgてき渲染ほどじょむねざい查找与报告SVGぶんけんちゅう存在そんざいてき问题
  • Svg-explorer-extensionいちLGPL自由じゆう许可てきWindowsぶんけん资源管理かんりつぶせてんよう生成せいせいSVGぶんけんてき缩略图。
  • iShell, a free MIT licensed extension for Windows Explorer that generates thumnails for SVG files
  • resvg, is one of the fastest and most correct SVG-render[50], also provides additional packages for viewer, optimizer (limited support) and extension for Windows Explorer
  • Inkscape, supports also Inkscape-features, which are not in the SVG-1.1-DTD-Standard
  • IrfanView, an image viewer provides a plug-in for svg-rendering
  • Imagine, another image viewer provides a plug-in for svg-rendering
  • batik, a java-based toolkit for svg-rendering
  • svgexport, a Node.js module
  • cairosvg, a Python library
  • ImageMagick, image-converter
  • chrome-svgrender, renders SVG files using Headless Chrome
  • SVG.NET, a basic renderer
  • QtSVG, a basic renderer
  • wxsvg, a basic renderer

转换

だい多数たすうSVG编辑つつみ含有がんゆう栅格いたりりょう转换图像描摹

  • toollabs:convertいち个PDF转SVGあずかSVG转PNG转换
  • Autotrace警告けいこく:其中いたりしょう一个链接遭到钓鱼网站篡改),2004ねんMartin Weber使用しよう以下いか工具こうぐ开发てきいち个库:
    • ImageMagick
    • autotracer.org,一个在线图像描摹工具,接受せつじゅJPEG、GIFPNG ぶんけん并输为SVG、PDF、EPS、AIDXF
    • Delineateいち个基于Javaてきめん费AutotracePotrace网站链接はしこう。Potrace也集成しゅうせいいたりょうInkspaceてきみちみち >临摹图轮くるわさい单中。
  • Scribus (with GhostScript), an EPS-to-SVG converter
  • PDFTron PDF2SVG, commercial PDF-to-SVG converter for Windows
  • Barton PDF2SVG, a PDF-to-SVG converter for Linux, which uses two free libraries called "Poppler" and "Cairo"
  • librsvg, a rendering library used by MediaWiki and the following converters:
    • RSVG-Convert, and open-source tool that converts SVG to PNG, PDF or PS
  • Bitmap to SVG converter - useful for converting pixel art
  • Vectorizer.AI, an artificial intelligence-based online tracer to convert raster image
  • PDF24 Tools, including an online PDF-to-SVG converter


编辑

  • Inkscapeめん费且开源てきSVG编辑,适用于Windows、macOSLinux。まいりHelp:Inkscape圖形ずけい編輯へんしゅう获取さら细节。
  • Sodipodi,一款已停止维护的免费开源SVG编辑,适用于WindowsLinux。
  • OpenOffice.org Draw,一款免费开源的绘图程序,本地ほんじ导出SVG,あんそうSVG插件きさき读取SVG。
  • LibreOffice DrawOpenOffice Drawてき衍生ひん导入导出SVG。ざい一些特殊情况下比Inkscapeさら为合适,れい如流ほど图。
  • Dia,一款免费开源的图表应用,适用于Windows、macOS,以及Unix类平だい目前もくぜんざいSVG导出じょうゆういち些漏ほら)。
  • Adobe Illustrator,一款商业矢量图编辑软件(且じゅうふんのぼる贵),ゆう丰富てき图形こうのうただしSVG特定とくていてきこうのう有限ゆうげんまいりHelp:Illustrator/zh获取さら细节。
  • Affinity Designer
  • CorelDraw
  • SVG-edit(GithubじょうてきSVG-edit),一款免费开源的网络应用ほどじょ
  • SVGedit.js,一款试验性的维基共享资源本地小工具。
  • Vector Paint - 一款简单的线上编辑器,可用かよう于剪さい注意ちゅうい对于ぼう特定とくていぶん档,剪裁无法正常せいじょう工作こうさく


专用应用

  • Ipe, a free and open-source editor with an SVG converter, with good LaTeX integration for mathematical and technical diagrams
  • Scour. For tidying up/create a smaller file size (in Python, also included in Inkscape).
  • Graphviz. An open source application for automatic diagram layout.
  • BKchem. A free software to draw chemical structures in SVG. Runs on Windows, Mac OS X, and Unix systems.
  • Freemind is a free and open source mind mapping application written in Java. FreeMind.
  • GeoGebra is a free and open source multi-platform mathematics software with ability to export SVG. Geogebra.
  • LibreOffice Calc (libreoffice.org), for creating bar charts, pie charts, etc.
  • Gnumeric spreadsheet, saves/exports charts in SVG format, cf. gnumeric.
  • Nano by Vecta.io - 压缩ぶんけん大小だいしょう
  • SVGO - reduces file sizes
    • SVGOMG - a web-based front-end for SVGO


はん

有人ゆうじん担忧SVG图像てきみなもとだい码会认为“计算つくえほどじょ”从而拥有ばん权,哪怕输出てき图像能因のういんてい于原创门槛而处于公有こうゆう领域,あるいんばん权到而无ほうあずか公有こうゆう领域てき作品さくひん区分くぶん开来。这或许意味いみつきかんいちぶくSVG输出てき图像处于公有こうゆう领域,ただし其代码可能かのうばん权受げんいん此不适合おさむ录到维基どもとおる资源。

Elements that weigh in favor of SVG source code containing sufficient creative expression to be copyrightable might include hand-written code, complex embedded CSS, embedded comments longer than short phrases, or a large carefully selected set of control points. Elements that weigh in favor of SVG source code lacking creativity include programmatically generated code or slavish copying of a public domain source. See the following for additional context:

まいり

维护:

参考さんこう资料

  1. 如果いちstyle元素げんそぼつゆう指定してい它的type屬性ぞくせい麼類がたしたがえsvg元素げんそてきcontentStyleType取的とりてき屬性ぞくせい(SVG DTD默認もくにんため“text/css”)。http://www.w3.org/TR/SVG11/styling.html#StyleElement
  2. http://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
  3. User:JoKalliauer/Optimization#SVG_sourcecode_edits_without_visual_change
  4. W3C – valid DTD list – Optional doctype declarations
  5. a b Don't include a DOCTYPE declaration, W3C – It is not recommended that a DOCTYPE declaration be included in SVG documents.
  6. W3C – There is no (normative external) DTD for SVG 2.0
  7. 验证 API,https://validator.w3.org/docs/api.html
  8. W3C:XML声明せいめい
  9. W3C:SVG–Prolog和文わぶん档类がた声明せいめい
  10. W3C:XML编码
  11. http://www.w3.org/TR/SVG/struct.html#NewDocumentOverview
  12. W3C: SVG linking
  13. W3C: SVG viewBox
  14. Philip Rogers (2015-04-30). Intent to deprecate: SMIL. Google Groups. Retrieved on 2015-06-27.
  15. https://caniuse.com/#feat=svg-smil
  16. User:JoKalliauer/Optimization#SVG sourcecode edits without visual change
  17. User:JoKalliauer/Optimization#Useless elements that should be kept
  18. https://github.com/scour-project/scour/wiki/Documentation#--renderer-workaround-and---no-renderer-workaround
  19. Inkscape FAQ: What about flowed text?
  20. You can change the colour, of the invisible path, which is used as the boundary of the flowRoot, similar to File:FlowRoot and flowRegion.svg, or you could also use the more general path-tag and create other shapes.
  21. User:JoKalliauer/RepairFlowRoot#replace notempty flow-text using (Inkscape)
  22. いち些案れい使用しようりょうtranslate=".."属性ぞくせいいち些则使用しようりょうtext-align=".."属性ぞくせい
  23. れい如该れいFile:Petit_Monde_de_Gondry,_Jonze_&_Kaufman.svg
  24. 也可以在Githubしも
  25. User:JoKalliauer/RepairFlowRoot#delete empty flow-text using (Text-Editor)
  26. Category:Images with SVG 1.2 features
  27. User:JoKalliauer/RepairFlowRoot#That the black square won't get rendered (Text-Editor)
  28. Attribute viewBox in SVG element takes precedence in defining the native resolution if it differs from width and height attributes.
  29. Font-kerning: Help with file at Graphics village pump, compare also File:Fonttest-Kerning.svg.
  30. textLenght attribute in w3.org
  31. http://www.w3.org/TR/SVG/fonts.html#FontFaceElementFontFamilyAttribute
  32. www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#generic-font-families
  33. a b User:AntiCompositeNumber on phab:T180923#6557063
  34. W3C: SVG – The ‘tspan’ element
  35. W3C: SVG – White space handling
  36. W3C: SVG 2 - The ‘xml:lang’ and ‘xml:space’ attributes
  37. librsvg still preserves this extra space character but during the middle or end text alignments, this space character is ignored.
  38. https://bugs.launchpad.net/inkscape/+bug/168023
  39. W3C: SVG – The ‘textPath’ element
  40. Avoid the ‚style‘ attribute where possible
  41. Chapter 11: Painting: Filling, Stroking and Marker Symbols. W3C (2012-08-12). Retrieved on 2012-11-28.
  42. paint-order. Mozilla Developer Network (2013-01-12). Retrieved on 2013-10-21.
  43. 优化SVGぶんけんてきいち个小技巧ぎこうゆかりWebpageFX提供ていきょう
  44. 35-optimizing-svg-tools by CSS-Tricks(35个svg优化工具こうぐゆかりCSS-Tricks提供ていきょう
  45. css-tricks : understanding-and-manually-improving-svg-optimization(css-tricks:理解りかい及手动优svg)
  46. Inkscape tutorial: Tracing
  47. Inkscape wiki: Tools: Vectorize/trace
  48. A feature bug report for this exists since January 2005 on Inkscape launchpad.)
  49. Claudio Rocchini使用しようC++だい制作せいさくてき图像
  50. User:JoKalliauer/SVG test suites

外部がいぶ链接