Commons:Transition to SVG

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
This project page in other languages:

The MediaWiki software running on our Wikimedia project wikis is enhanced to deal with SVG (Scalable Vector Graphics).

SVG has these advantages
  • It is not a pixel-based image file format and thus is scalable indefinitely to any size without loss of sharpness. Since it is resolution-independent, the file size is the same regardless of the image's resolution.
  • Vector representations are often of much smaller file size for items of low or moderate complexity; file size does not increase with resolution, but with actual content or detail.
  • SVG is a much better fit with wiki editing, because unlike raster images, it is fairly straightforward to edit SVGs. You can easily change things, objects, shapes, style — colors, outlines, gradients — as well as existing elements — contours, text, etc.
  • Since Wikimedia projects are intended to be free content, SVGs are important, because a raster image that is difficult to modify is not free. You can extract content from SVG files without any problem and reuse it in other files.
SVG has these disadvantages
  • Problems with SVG images of poor technical quality have also caused more serious issues sometimes and limits have been set for SVG rendering time to try to limit this harm.
  • The Wikimedia servers currently cannot render all types of SVG features, so the generated PNGs are sometimes not as the author intended.
  • Due to the level of detail, complex images may result in an SVG having a larger file size than a raster counterpart of a file.
  • Vectors can hardly produce photorealistic images, but that is not their purpose anyway.

Even with the disadvantages of SVG, it is good to encourage the use of lossless image formats, so there is merit in providing SVG alternatives and encouraging people to use them. To request a raster image to be converted to SVG, add the label {{Convert to SVG}} to its description page.


As flags are used heavily in all Wikimedia projects, they need at first to be replaced with the SVG-version there. Perform the following steps:

  1. Check that the policy on the project you want to change wants this change. If it does not, you must not make the change at that project. The project policies rule when there is a conflict with preferences here. If there is no policy or you don't find it, ask first! Wikinews is one project that does not want this, in part because it needs a complete and accurate historical record of exactly what its old stories contained!
  2. Go to Category:Flags take your nation/country/city/whatever flag that is interesting to you and see if there is already a replacement SVG-version of it in Wikimedia Commons.
  3. If not, go to or create your own SVG version of the flag (e.g., with Inkscape) and upload it to Wikimedia Commons.
  4. Mark the description page of the pixel-flag-version with a hint that an SVG version exists, using the {{Vector version available}} template. This suggests that people use the SVG version if practical.
  5. Give people and projects time to replace the image if they want — many months, because it takes time to discover and decide.
  6. Go to Special:GlobalUsage and look up the current usage of the pixel-version-flag. Change the image links in articles to the SVG version, starting with those on your own project. Remember to ask for help from others on your project, as conversion is a lot of work.

Replacing images

You can use Commons:GlobalReplace to quickly find and replace files globally across Wikimedia Projects. Also, many 'bots that run on the wikis are very capable of this task and bot operators tend to be very eager and willing to help and show off their “monsters” where they can. Make sure that you leave a message in the Village Pump of each project requesting bot help if it is available. It takes a bot, depending on many different factors, from a few hours to perhaps a day to run through the whole Wikipedia replacing images; it takes a human eons and they're in a bad mood when they finish.

Please remember that a bot needs specific permission from every project in which it operates and that permission must be given for each different task the bot does. There is no permission that applies for all projects and all uses of a bot. Operating a bot on all projects is likely to get the bot and/or its operator blocked on all projects as an emergency measure if it breaks policies on the wikis where it is being used!


There have been complaints about PNG images being replaced by inferior quality SVG images, or, even, by factually incorrect ones. The latter is not acceptable by an encyclopaedia project. Make absolutely sure that the quality of the replacement is the same or superior to the original, before marking it as redundant. Otherwise, the original raster image should be left in place until a quality SVG can be found or produced.

PNGs should not just be replaced en masse the instant an SVG replacement becomes available. It is often sufficient to label the image description page with a {{Vector version available}} tag, and it will be migrated over to the SVG version by editors where appropriate. This is especially true when there are still residual fixes that need to be made to the vector file to bring it up to quality with the file it is proposed to replace.

It’s highly recommended to use a valid SVG format. This will ensure that your image will remain usable over time and will make edits possible in other SVG editors. Files saved using Inkscape or Adobe Illustrator format sometimes contain non-standard elements which will generate rendering errors or trigger bugs on Wikimedia’s render engine, or may create an unnecessary increase in file size. To validate your files you can use the W3C MarkUp Validator, or, to check for common problems, which may prevent correct display in “rsvg”, you may use the Commons:SVG Check.

Please be aware that all fonts are not available on every system. Commons SVG files should be designed to render reasonably on Commons and on other systems. Consequently, text should have plenty of room to toleraate size variations when fonts are substituted for ones that are not available. It is a good idea to designate CSS generic font families ("serif", "sans-serif", and "monospace") as a fallback font.


MediaWiki SVG support has serious limitations when it comes to rendering. Read Help:SVG for details.

These and other bugs should be reported at the librsvg (GNOME) GitLab or (WikiMedia) Phabricator, and example images get a tag {{Rsvg bug|description=}}, see Librsvg bugs. However, as of 2016, GNOME does not provide any more support to deal with the almost dormant maintenance of major librsvg bugs; that also means support of SVG 2.0 is unlikely to happen when it is already supported by mainstream browsers.

See also