Wikipedia:SVG_help

Wikipedia:SVG help

Wikipedia:SVG help


More information Original text, Replacement text ...

Assistance

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

Create a new request

2026 FIFA World Cup qualification eliminations

I am trying to edit recent eliminations from World Cup qualifying for this month, but I fear that I may screw up the process. The countries eliminated are Chinese Taipei, Turkmenistan, Hong Kong, Nepal, Pakistan, Turks and Caicos Islands and U.S. Virgin Islands. The image is File:2026 world cup qualification map.svg. Thank you. David Matoushek (talk) 03:26, 27 March 2024 (UTC)

Need code help regarding font and validation

Hello, could someone help me with 2 code issues. The SVG file was created with Inkscape.

1) I used the free font "Liberation Sans" in Inkscape and later added the fallback fonts manually into the code. But the tool SVG Check shows the following error: "*Warning* You appear to have specified a font that does not exist on Wikimedia wikis."

Excerpt from the current code:

  </g>
  <text
    xml:space="preserve"
    style="font-size:10px;font-family: ' Liberation Sans ', Arial, sans-serif;text-align:center;text-anchor:middle;fill:#231f20;stroke-linecap:round"
    x="198.7005"
    y="99.675446"
    id="text5"
    inkscape:label="text5"><tspan
      sodipodi:role="line"
      id="tspan5"
      x="198.7005"
      y="99.675446">Example</tspan></text>
  <text

2) Regarding validation with the w3c validator I get the following error:

"Attribute data-name not allowed on SVG element svg at this point." which refers to line 12:

xmlns:svg="http://www.w3.org/2000/svg">

Excerpt from the beginning of the code:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
  id="Layer_1"
  data-name="Layer 1"
  viewBox="0 0 1938 930.5"
  version="1.1"
  sodipodi:docname="Project.svg"
  inkscape:version="1.3.2 (091e20e, 2023-11-25)"
  xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
  xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
  xmlns="http://www.w3.org/2000/svg"
  xmlns:svg="http://www.w3.org/2000/svg">
  <sodipodi:namedview
    id="namedview107"
    pagecolor="#ffffff"
    bordercolor="#000000"
    borderopacity="0.25"
    inkscape:showpageshadow="2"
    inkscape:pageopacity="0.0"
    inkscape:pagecheckerboard="0"
    inkscape:deskcolor="#d1d1d1"
    inkscape:zoom="0.87516787"
    inkscape:cx="1439.7238"
    inkscape:cy="375.35656"
    inkscape:window-width="1512"
    inkscape:window-height="916"
    inkscape:window-x="0"
    inkscape:window-y="38"
    inkscape:window-maximized="0"
    inkscape:current-layer="Layer_1" />
  <defs
    id="defs1">

Your help would be much appreciated. Thank you. Abvdj (talk) 20:29, 2 April 2024 (UTC)

@Abvdj: First, which image are you working on? Second, if posting snippets of SVG markup, please place them inside <syntaxhighlight lang=xml>...</syntaxhighlight> tags (see for example several of the posts at Wikipedia:SVG help/Archive 8). --Redrose64 🌹 (talk) 21:01, 2 April 2024 (UTC)
The SVG is designed to visualize the complex pathology of a very rare metabolic disease. It is a flow chart. Thanks for the hint, I will integrate code better in the future. The goal is also that the svg file can be translated into several languages and can be updated later as research progresses. Abvdj (talk) 10:02, 3 April 2024 (UTC)
@Redrose64 I've tried a few more things in the meantime. But unfortunately I can't solve it. Abvdj (talk) 20:29, 4 April 2024 (UTC)
If you don't tell me which file you are working on, I can't help you. --Redrose64 🌹 (talk) 21:08, 4 April 2024 (UTC)
@Redrose64 I haven't uploaded it yet. Thought it shouldn't be uploaded if it doesn't pass the svg checker and w3c validation. Abvdj (talk) 21:59, 4 April 2024 (UTC)
Hi @Abvdj:
1) It's a known issue that the checker warns about fonts that it doesn't recognise, even if they are fallback ones, in this case, Arial. What you did was correct, so you can ignore this warning.
2) The error message states it clearly: the svg tag should not have an attribute called data-name. http://stackoverflow.com/a/15580322 explains that data-... attributes are not in SVG 1.1, the version Wikimedia currently uses.
Hope that helps, cmɢʟeeτaʟκ 10:03, 7 April 2024 (UTC)
Hello@Cmglee
Thank you for your response. That's good to know. Much appreciated. Abvdj (talk) 21:18, 15 April 2024 (UTC)

Gradients incorrectly rendered

The bottoms of the clouds in the first thumbnail are not transparent, as in the browser rendering or the second thumbnail. Would anyone know of a remedy?

Secondly, in the first uploaded version, the radial gradient behind the lady (grad_studio in the source) is not rendered at all, giving just a solid grey. I think it's because its cy over 100%. I replaced it with a linear gradient in the second upload. Is this a known issue?

Thanks, cmɢʟeeτaʟκ 00:49, 15 April 2024 (UTC)

It may be a completely different issue, but in earlier versions of this image: , the gradient didn't render. JoKalliauer solved the problem, apparently by using Inkscape to form that element. I don't understand why it works and my text editor attempt did not, or if it's relevant to your problem, but you could try Inkscape to form the element(s) in question. —RCraig09 (talk) 00:54, 15 April 2024 (UTC)
Thanks, @RCraig09: I'd still like to find out exactly what causes gradients to not work so that text-editor editors can get it right the first time. Cheers, cmɢʟeeτaʟκ 16:07, 17 April 2024 (UTC)

Need help with electoral map rendering

Hello, I'm having a few issues getting an electoral map to render correctly.

In the picture I have several areas of the map that are transparent. When I load this map into an editor (or if you view it directly here!) these transparent areas don't exist at all, bar the expected one in the top right, which is how I want the map to look. What's making this tricky for me to correct is that most of these areas don't correspond to any existing divide on the map - for example, the bottom right transparent area on the map doesn't line up with any ward at all, so I can't see anything to change. RandomEditsForWhenIRemember (talk) 20:10, 19 April 2024 (UTC)

Just to clarify, @RandomEditsForWhenIRemember: all the transparent regions in the thumbnail should be blue, except the top-right one which should remain transparent? cmɢʟeeτaʟκ 02:50, 20 April 2024 (UTC)
I've worked out what we're seeing but not yet why. The true SVG version at Media:Cotswold UK ward map 2011.svg is mostly correct (the blank area at extreme upper right should be light brown  , this may be a genuine error, compare c:File:Cotswold UK ward map 2015 (blank).svg where it's drawn in light brown). In the PNG version as rendered at c:File:Cotswold UK ward map 2011.svg, the cream   light blue  , light brown   and red   areas are also mostly correct (again, the transparent area at extreme upper right should be light brown  ); however, the blue  , grey   and orange   areas - and their outlines - are all displaced downwards by the same amount as each other, relative to the first four colours. Look at the blue area at bottom left - its upper outline is exactly the same shape as the upper outline of the transparent area above it. So where a blue, grey or orange area is correctly adjacent to a light brown area in the true SVG, the PNG shows either a gap (which shows as transparent) or the blue, grey or orange is drawn in front of the light brown, hiding the latter. Consider also the positions of the light blue areas relative to the others - for example, the cluster at lower centre is drawn in front of the orange and light brown on the true SVG, but in front of the orange and blue on the PNG. --Redrose64 🌹 (talk) 12:05, 20 April 2024 (UTC)
@RandomEditsForWhenIRemember: It's to do with the transforms. The shapes that are displaced downwards are all inside a
<g transform="matrix(1, 0, 0, 1.6, 0, 148.49873)" id="Wards" style="transform-origin: 704.89px 247.496px;">
...
</g>
element whereas the correctly-positioned shapes are in other g elements with differently-constructed transforms, more specifically, none of them have a transform-origin: property. This property is not part of the SVG 1.1 spec, and whilst it is part of CSS Transforms Module Level 1, librsvg doesn't recognise any CSS properties that are not explicitly part of CSS level 1. That, I'm pretty sure, is the problem, but I don't know what to do about it. --Redrose64 🌹 (talk) 13:49, 20 April 2024 (UTC)

How can I resize SVG images (not just the objects within them)?

E.g. If I have a simple graphic image, and want to reduce it to 1/5 canvass size without any change in appearance. (It's helpful to have all images in a series set to the same size, line weight, etc., especially when merging them together or exchanging elements.)

For example, File:Cepheus symbol (bold).svg is currently on a 102x102 px canvas, and I'd like to reduce it to 16x16 px.

Currently, I can only do this by resizing the canvass, resizing the object, and then repositioning the object, which is okay for a few files but adds up when converting lots of them (about 200 in this case).

If I could do it in bulk, that would be even better.

BTW, I'm on Linux.

Thanks. — kwami (talk) 06:17, 22 April 2024 (UTC)

As I understand your request:
<g transform="scale(0.1568627,0.1568627)"> . . . </g>
will achieve the size reduction of SVG ". . ." elements. Of course, you'll have to adjust the width and height specifications and any viewbox setting that you have, near the top of your SVG vile. —RCraig09 (talk) 16:50, 22 April 2024 (UTC)
@RCraig09: Kwamikagami is not asking about individual elements, but the whole image.
@Kwamikagami: Don't worry about transform - look at the second line of the file, where there is a <svg> tag - this has two attributes width="80.4pt" height="80.4pt". These can take a variety of values, you could alter them to width="16px" height="16px". You should not need to alter anything else. --Redrose64 🌹 (talk) 20:25, 22 April 2024 (UTC)
If I only change the width and height specifications in the <svg . . .> specification, it chops off most of the image. I think the <g transform="scale(0.1568627,0.1568627)"> . . . </g> specification must also be used on all the elements in the image. —RCraig09 (talk) 20:50, 22 April 2024 (UTC)
That should not happen. Make sure that you leave the viewBox="0 0 80.4 80.4" attribute unchanged. --Redrose64 🌹 (talk) 21:40, 22 April 2024 (UTC)
That works perfectly. Thanks! — kwami (talk) 22:38, 22 April 2024 (UTC)


So, the LT 2024 logo has a few letters that look corrupted when shown on Wikipedia, but when I click on the original file, it shows the complete logo… VenezuelanSpongeBobFan2004 (talk) 07:49, 25 April 2024 (UTC)


Share this article:

This article uses material from the Wikipedia article Wikipedia:SVG_help, and is written by contributors. Text is available under a CC BY-SA 4.0 International License; additional terms may apply. Images, videos and audio are available under their respective licenses.