Wikipedia:SVG help
SVG help Scalable Vector Graphics is a commonly used file format for providing a geometrical description of an image using basic objects such as labels, circles, lines, curves and polygons. An image can be reduced or enlarged to an arbitrary size, and will not suffer image data loss, nor will it become pixelated. SVG makes an excellent format for artwork, diagrams and drawings. SVG images are defined in XML text files. This means that they can be searched, indexed, scripted, and compressed. Since they are XML files, SVG images can be edited with any text editor, but SVG-based drawing programs are also available. However, the rendering engine used by wiki is not perfect, and may cause the image to be shown incorrectly, or differently from how it is displayed in your vector editor of choice. This page enables authors experiencing problems with SVG graphics to obtain some help in getting their images into wiki the way they intend. |
Things we can help with Understanding SVG
Using SVG appropriately
What you see is not what you get
Something new
| ||||||
General suggestions[edit]The following is a list of common vector editors and suggested settings for compatibility. The user guide of your chosen program may also be valuable in troubleshooting. Browsers[edit]Most modern browsers can render SVGs in view-only mode. It may be convenient to set a browser as the default SVG viewer, but you can also paste the file path into the address bar. Please note that even if your browser renders an SVG correctly, it may render differently on Wikipedia. Text editors[edit]SVG documents are text files, and can be edited like any other text file. Specifically, SVGs are XML documents, which have special support in many text editors. One potential disadvantage to editing SVGs by hand is that previewing your changes is more cumbersome. A rudimentary solution would be to open the SVG file in a browser while working on it, and manually refreshing the document to see the result of changes. Inkscape[edit]There is a simple work-around for the scarcities of librsvg. The operation "Stroke to Path", to be found under Menu>Path in Inkscape or via Ctrl+Alt+C, can be applied to all of the objects that are not rendered correctly. To keep the SVGs editable, this should only be done to the files intended for upload, and these files can be deleted afterwards. As of February 2014, the objects that must be modified to render correctly by librsvg include:
OpenOffice.org[edit]OpenOffice.org SVG files may require manual modification before being uploaded to Wikipedia. To achieve this:
NB: Vector graphics line widths may also need to be set explicitly in OpenOffice.org Draw. SVG code replacement guide (executing replace all using Nedit regular expressions)[edit]
This SVG export procedure has been tested using OO 2.3.0 and OO 3.2.1 with a simple .odg candidate. Microsoft Powerpoint[edit]It is easiest to save entire slides from Powerpoint as svg rather than saving multiselected objects with right click / save as picture, because for entire slides the boundaries will be cropped to the size of the slide and the background will be set to white. To save slides as svg, use file / save as / browse / save as type --> svg. If your slide has text, open the exported svg into Notepad and replace all the existing font-family specifications with Text can also get chopped up on export, which causes rendering and localization bugs. To fix this, search for all Microsoft Visio[edit]Generating SVG charts from spreadsheet programs such as Microsoft Excel[edit]![]() Warming stripes (five examples compared) ... in a shape Warming stripes bar chart Bar chart Pie chart Variable-width bar chart Line charts Scatterplot Radar chart I've uploaded spreadsheets that automatically generate XML code for charts in SVG format. Summary: You simply paste or enter your data into the spreadsheet, and specify image dimensions, number of grid lines, data ranges, font sizes, etc. The spreadsheets instantly and automatically generate a column of XML code. You simply copy and paste that code into a text editor and save as an ".svg" file. The spreadsheets produce lean SVG code, and should save you time in creating SVG charts. Though my original spreadsheets are written in Microsoft Excel, I've received reports that they also work if read into other spreadsheet programs. Feedback and suggestions on my talk page are welcome. RCraig09 (talk) 23:41, 19 February 2021 (UTC) Click HOW TO for detailed explanation.
Click here to see an example of how the spreadsheets work, internally.
Example SVG files: Category:SVG graphics created with spreadsheet.
Text guidance[edit]Use text over paths[edit]Converting text in an SVG file into paths (shapes) increases file size, prevents localization/accessibility features, and complicates edits/modifications down the line. It is therefore generally disfavored, with some exceptions, such as text-based logos. The Wikimedia text renderer can introduce bugs as its fonts may differ from browser fonts or SVG editor fonts, but following the guidance below should minimize these errors. font-family property[edit]![]() Due to copyright restrictions, MediaWiki cannot use proprietary fonts that are commonly found on several proprietary operating systems. Fonts such as Geneva require licensing fees to distribute. rsvg will not be able to locate such fonts, and the text will fail to appear in the rendered image. There are three solutions to this issue:
For ease of subsequent editing and significantly smaller file sizes, substituting the font with an available font is recommended. Many common fonts have non-proprietary alternatives that are similar in typographical style, resulting in minimal disruption to existing images during substitution. For a list of fonts available in Wikipedia, see available fonts on Meta. Wikimedia has default fonts, and will use Liberation Serif for Times New Roman and Liberation Sans for Arial. For further fallbacks see c:Help:SVG#fallback. Fonts that are available on Wikimedia servers may or may not be available on a visitor's machine. If the placement or appearance of text in the image is important and there is uncertainty about which fonts are installed on a visitor's machine, then converting text into path information may be necessary. font-size property[edit]![]() font-size="35" (or larger) appears to avoid this problem, depending on the pixel size of your graphic.Fonts should be sized so that they look good as thumbnails on wikipedia pages and so they are easy to view on smartphones. Smartphones are how most people access wikipedia. Thumbnails are how most other people see images, as very few people click images and zoom them in to see them. Avoid using or creating images with fonts that are too small to be legible in thumbnail or smartphone views. The font size that appears in a thumbnail is a combination of svg width, thumbnail width, and font size. To match wikipedia font size as a thumbnail, use font-size = (63/(your upright value))*((your svg width)/1000). For instance, if the thumbnail will be scaled up to thumb upright=1.35 and your image has svg width of 960, set font-size in the svg to (63/1.35)*(960/1000) = 44.8. Background colors[edit]Transparent backgrounds are fine, but do not think your image will always be displayed on a light or white background. The wikipedia smartphone app, for instance, renders images on a black background, so if you show black text on a transparent background it will be invisible. Testing for problems[edit]The following SVG checkers may help you to detect SVG problems before you upload: None of these checkers are foolproof, so it's wise to validate images. You can preliminarily validate images by uploading them to the shared, temporary-use location Test.svg, though other users may overwrite your image at any time. To force refresh images in your browser use Ctrl+F5 (Shift-Reload on Mac), so that you see the latest upload and not cached image copies (this is necessary even on wikimedia upload pages). Rendering SVG files[edit]On Wikipedia SVGs are interpreted by the librsvg-library to create PNG previews at different image sizes (to rasterize them). That library only recognizes a subset of all valid SVG syntax, and may render your SVG without many features. In order to bypass these deficiencies in the library, there are certain parameters that need to be formatted in specific ways or be assigned a workaround value in order for librsvg to accurately render views of your SVG file. Some issues are enumerated below, but be sure to test your SVG files before and after uploading them. <mask> parameter maskUnits="userSpaceOnUse"[edit]The librsvg-library does not interpret the value of parameter stroke-dasharray[edit]The librsvg-library does not accept a Use [edit] |
Assistance
[edit]If you have a tricky SVG file with a problem not described, or can't quite figure out what the previous section was talking about, you can simply ask for assistance by posting a quick note hereafter that outlines the problem, as well as providing links to the files that are exhibiting these problems. Don't forget to sign your name with four tilde symbols (~~~~) and an editor will attempt to reply here to help!
When you are happy that a request has been fulfilled, just leave a note so that the request can be archived later, as needed.
An alternative source of help is Commons:Graphics village pump.
Current requests
[edit]
This page has archives. Sections older than 30 days may be auto-archived by Lowercase sigmabot III if there are more than 4. |
Embed svg directly
[edit]is there a way i can force wikipedia to directly embed svgs instead of embedding the thumbnail in my browser? im not asking about doing it on a page im editing, im asking about doing it to all pages in my browser thanks! Specimen3757 (talk) 17:10, 3 October 2025 (UTC)
- I don't think so. I suspect the reason why not is security concerns about embedding user-generated markup. —David Eppstein (talk) 17:54, 3 October 2025 (UTC)
- ah. that actually does make a lot of sense. thanks! - Specimen3757 (talk) 20:49, 3 October 2025 (UTC)
- @Specimen3757: Not directly, but you can link a thumbnail to an SVG in Commons using {{filepath:FILENAME}} as in this example (click the thumbnail or the link beneath). cmɢʟee τaʟκ (please add
{{ping|cmglee}}
to your reply) 01:11, 8 October 2025 (UTC)

- Though Media: creates a direct link to a file, filepath: returns just the file's URL, and thus can be added as a link parameter of a thumbnail so that clicking the thumbnail goes to the file instead of Media Viewer or the file description page, perhaps closer to what the questioner intended. A messier alternative is to use an imagemap covering the entire thumbnail.
- Can you please link to guidance that CC-BY files cannot be linked this way legally?
- Cheers, cmɢʟee τaʟκ (please add
{{ping|cmglee}}
to your reply) 19:54, 8 October 2025 (UTC)- It's stated in at least three different places:
- Template:Multiple image#Syntax and parameters includes
If the image is under a free license (such as the GDFL or a free CC license), the terms of such license require the license, or a link to it, to be reproduced with the image. The image must, therefore, link to its image description page, which can be achieved simply by omitting the link[n] parameter from the template as mentioned. Public domain and (theoretically) non-free use images are not subject to this restriction.
- MOS:NOALT says:
Removing the link is acceptable only for images in the public domain or the equivalent CC0. Links should not be suppressed for any image that requires attribution.
- WP:EIS#Link says:
Except for public-domain images, it must always be possible for the reader to reach the image-description page, so
|link=
should be used only with|thumb
images.
- Template:Multiple image#Syntax and parameters includes
- The first two images as used above are not thumb images; there is no means of reaching the file description page in order to view the license and attribution. The third, on the other hand, includes a magnifying glass icon (bottom right) which provides that link. --Redrose64 🌹 (talk) 22:22, 8 October 2025 (UTC)
- Got it, so it's ok if there is a magnifying glass or similar icon linking to the file description page. I edited the multiimage above, but the wikitext becomes very messy. Furthermore, the magnifying glass image itself is CC-BY-SA so will that need another icon to link to its file description page? How does one get the default image used in thumbnails? cmɢʟee τaʟκ (please add
{{ping|cmglee}}
to your reply) 01:02, 9 October 2025 (UTC)- Don't worry about the magnifying glass, it's used millions of times so this must have been raised before. What do you mean by "the default image used in thumbnails"? --Redrose64 🌹 (talk) 18:55, 9 October 2025 (UTC)
- I meant the smaller rectangle on top of a larger one as in the thumbnail caption above. cmɢʟee τaʟκ (please add
{{ping|cmglee}}
to your reply) 19:48, 10 October 2025 (UTC)- This one? As I say, don't worry about it. --Redrose64 🌹 (talk) 22:03, 10 October 2025 (UTC)
- I meant the smaller rectangle on top of a larger one as in the thumbnail caption above. cmɢʟee τaʟκ (please add
- Don't worry about the magnifying glass, it's used millions of times so this must have been raised before. What do you mean by "the default image used in thumbnails"? --Redrose64 🌹 (talk) 18:55, 9 October 2025 (UTC)
- Got it, so it's ok if there is a magnifying glass or similar icon linking to the file description page. I edited the multiimage above, but the wikitext becomes very messy. Furthermore, the magnifying glass image itself is CC-BY-SA so will that need another icon to link to its file description page? How does one get the default image used in thumbnails? cmɢʟee τaʟκ (please add
- It's stated in at least three different places:
rsvg messes up radial gradient in a transformed path
[edit]
In this thumbnail, when I applied a "matrix(1,-0.5 0,1 -70,-35)" transform on a path which has a radial gradient, the gradient bleeds to the edge of the path. The desired effect, similar to File:3d-ambigram.jpg, is correctly rendered in Chrome and Firefox. Can anyone please suggest a solution or workaround if I still wish to use the transform?
Note: The bug still appears when the Gaussian blur filter is removed.
Thanks, cmɢʟee τaʟκ (please add {{ping|cmglee}}
to your reply) 01:09, 9 October 2025 (UTC)
- I notice that some (all?) of your matrix values have both commas and spaces between values. This might be a situation like #parameter stroke-dasharray above, so try using commas consistently, as in --Redrose64 🌹 (talk) 18:52, 9 October 2025 (UTC)
<g transform="matrix(1,-0.5,0,1,-70,-35)">
- Re stroke-dasharray: I've used it in spaced form with no problems, e.g. in File:Tschirnhausen cubic spline.svg. Is this working finally or is it merely that I'm using it in such a simple form (only one length for both dash and space) that the buggy and correct behavior look the same? —David Eppstein (talk) 21:54, 12 October 2025 (UTC)
- I haven't noticed any problems with
stroke-dasharray
. The only such issue I'm aware of is withviewBox
(and total lack of delimiters around thea
(arc) path command's Boolean flags, e.g.a7.147 7.147 0 011.77-1.306
[1]). cmɢʟee τaʟκ (please add{{ping|cmglee}}
to your reply) 02:22, 13 October 2025 (UTC) cmɢʟee τaʟκ (please add{{ping|cmglee}}
to your reply) 02:22, 13 October 2025 (UTC)
- I haven't noticed any problems with
- Re stroke-dasharray: I've used it in spaced form with no problems, e.g. in File:Tschirnhausen cubic spline.svg. Is this working finally or is it merely that I'm using it in such a simple form (only one length for both dash and space) that the buggy and correct behavior look the same? —David Eppstein (talk) 21:54, 12 October 2025 (UTC)
- Thanks for the suggestion. I've delimited terms with commas and still get the same result. cmɢʟee τaʟκ (please add
{{ping|cmglee}}
to your reply) 19:48, 10 October 2025 (UTC) - In case it's useful to anyone in the future, rsvg seems to require
Resolved
gradientUnits="userSpaceOnUse"
to successfully transform a gradient along with its shape. cx, cy, r and other parameters must be tweaked to match. However, rsvg doesn't accept percentages in the parameters so their values in pixels must be estimated. cmɢʟee τaʟκ (please add{{ping|cmglee}}
to your reply) 19:04, 12 October 2025 (UTC)- For attributes such as
cx=
etc., if you specify the value in pixels, it's a known distance from the origin. which is itself defined by theviewBox=
attribute. However, whilst that attribute also defines the size of the visible portion of the canvas, it doesn't define the size of the drawing canvas, which is unbounded, and effectively infinite. I think that the problem is that if you specify a percentage, it needs to be a percentage of some known value - and what is, for example, 50% of infinity? --Redrose64 🌹 (talk) 21:48, 12 October 2025 (UTC)- Good analysis; that makes sense, though it's a hassle in practice as one needs to know the size of the shape being filled unlike when
gradientUnits="userSpaceOnUse"
isn't used. Cheers, cmɢʟee τaʟκ (please add{{ping|cmglee}}
to your reply) 02:13, 13 October 2025 (UTC)
- Good analysis; that makes sense, though it's a hassle in practice as one needs to know the size of the shape being filled unlike when
- For attributes such as