Jump to content

Community Wishlist Survey 2021/Multimedia and Commons/Option to load SVG instead of PNG on pages by default

From Meta, a Wikimedia project coordination wiki

Option to load SVG instead of PNG on pages by default

  • Problem: All SVG content is converted to PNG before sent to public.
  • Who would benefit: Servers, readers, and basically anyone.
  • Proposed solution: Load SVGs instead of PNGs on content pages (and file pages by default)
  • More comments: I'm proposing this so as to load SVG content natively (i.e. SVG directly delivered to content) instead of backend renders. Browsers have long been natively supporting SVG content, so it seems weird that vectors are still converted to raster graphics when web browsers genuinely support SVG already for a long time. It can be enabled as default on PC clients before introducing it to mobile though, considering even the lowest end PCs are able to load SVGs in browsers natively, but cannot confirm the state of it in mobile phones. Also, it helps in cases of Math functions where wikicode is transcluded to SVG before transcluding again to PNG content.
  • Phabricator tickets:
  • Proposer: 1233 T / C 18:37, 19 November 2020 (UTC)[reply]


Some infos about santizing: https://github.com/scour-project/scour/issues/254#issue-632703337  — Johannes Kalliauer - Talk | Contributions 06:26, 9 December 2020 (UTC)[reply]

With showing SVG files directly, comes the power of SVG animations (SMIL). Comparing SMIL to gif animations is like comparing SVG to PNG or JPEG formats (though Internet Explorer does not support SVG animations). Also it seems that Wikimedia does not support some SVG features like text along path (see the first image) or has problem showing patterns (See the second image). So I think showing SVG files directly would be a good thing.


  • Could you please provide some examples of different rendering on different browsers?
  • SVGs can be edited to change the fonts (for example to some web-safe font). Also Wikimedia fonts are not comprehensive enough (for example there is not a single Persian font installed)
  • Do all SVG files have longer client-rendering time? I don't think it will be noticeable even for a medium-sized vector.

What percentage of SVGs are 25- and 95-megabyte files? The particular images you mentioned have almost no usage on Wikipedia. Jooja (talk) 18:48, 11 December 2020 (UTC)[reply]

librsvg-rendering of one the view featured svgs
Rendering by most browsers


 — Johannes Kalliauer - Talk | Contributions 19:53, 11 December 2020 (UTC)[reply]

@Jooja: Your examples are the best example to show, as long as you know the renderer the bugs can be fixed (both are fixed), but without knowing the renderer the rendering is unpredictable and bugs can't be fixed.  — Johannes Kalliauer - Talk | Contributions 21:21, 11 December 2020 (UTC)[reply]

I hadn't seen this page which is for resvg library. It seems a good comparison table for SVG support in some browsers and libraries (including librsvg). Jooja (talk) 10:57, 12 December 2020 (UTC)[reply]

@Jooja: I would also prefer resvg (by @RazrFalcon:), it is imho maybe the most promising svg2png-libary, in terms of supported features and especially for speed. Since it is optimized for speed, maybe an additional png-optimizer for WikiMedia might make sense to reduce file-size (reduces ~10%), but that's no problem. However animated SVGs will be rendered as a static png-image, but native animated svgs are imho also not considered as a web-save-option, so there exist imho no workable solution for animated SVGs.  — Johannes Kalliauer - Talk | Contributions 15:44, 12 December 2020 (UTC)[reply]

@Ralf Roletschek: Special:Diff/20821104

  • German(Deutsch): Wenn man ein SVG-Bild als PNG braucht, dann soll das der Nutzer selbst konvertieren. Kann man online machen, kann man mit Freeware machen,... Außerdem ein Vektorbild als Rasterbild zu bearbeiten ist genauso sinnvoll ein Qualitätsbild mit Fujifilm X-M1 mit einer Auflösung von 200px x 150px aufzunehmen.
  • English: If someone wants a SVG as PNG, than it's the users issue. It can be done online or per Freeware. Converting SVG2PNG is as intelligent as having the best camera and saving the image which a resolution of 200px x 150px.

 — Johannes Kalliauer - Talk | Contributions 08:22, 17 December 2020 (UTC)[reply]

SVG ist in der wahren Welt da draußen nahezu unbekannt und unbrauchbar. Es ist wertlos für Nachnutzer, deshalb sollten wir denen wenigstens PNG anbieten. Ist zwar ebenso wenig verbreitet, kann aber wenigstens fast immer gelesen werden. --Ralf Roletschek (talk) 10:18, 17 December 2020 (UTC)[reply]