Does Inkscape have a way to put points on a curve or line so the coordinates of the points will be written to the svg file? I seem so close to doing this, but perhaps I need a different program.

The example image shows a Bezier curve (using c in the svg) with two nodes, markers on each of the two nodes (but no more), and a dotted stroke between the nodes.enter image description here

I think if each of the "dots" of the stroke could be written out as coordinates, my objective might be reached. I have been able to add nodes, and I could add them to each of those dots and it will work, but will be difficult for large drawings. If nodes are the only way to get coordinates it would be good to know, and if the nodes can be evenly spaced, that will be ideal.

I am omitting the svg file contents for brevity, but I have made some progress on my objective of getting circles centered on the points describing a curve by editing the svg file (see this post for example). I have discerned some relationships between x,y coords of nodes, circle, m, c, z records in the svg, but that is in progress. So far - not always straight forward. Processing will ultimately need to be done with command-line tools such as awk,bash,sed when the number of points is large enough.

UPDATE : I just found this SO post which will help - I just started working on this though :

How to extract the cartesian coordinates (x,y) of an svg image?

the curve in svg format:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

   viewBox="0 0 210 297"
   inkscape:version="1.1.2 (0a00cf5339, 2022-02-04)"
     inkscape:current-layer="layer1" />
     id="defs2" />
     inkscape:label="Layer 1"
       d="m 53.049246,151.83874 c 2.08256,-72.783154 80.316864,-35.42292 80.316864,-35.42292"
       sodipodi:nodetypes="cc" />

  • I dont think your approach is ultimately very productive. As svg does not guarantee what you want. First theres no guarantee that the scale of your points is what you want, also not nesseserly written in absolute coordinates and so on. so you should not really rely on svg text parsing for anything
    – joojaa
    Commented Feb 23, 2023 at 18:07
  • 1
    also this seems like a xy question as in your asking what you think will solve your problem. Not describing your actual problem. Your also most probably in wrong place for asking.
    – joojaa
    Commented Feb 23, 2023 at 18:15
  • Have to agree, this does appear to be an XY problem. Why do you want to do this? What problem are you actually trying to solve by doing this? Why does it matter if the dots have co-ordinates? You can add extra nodes using the Insert Nodes button in the Controls Bar when you have the Edit Paths by Nodes tool selected. - select one or more segments, and hit the button repeatedly
    – Billy Kerr
    Commented Feb 23, 2023 at 18:35
  • this thread might help : stackoverflow.com/questions/15857818/python-svg-parser ... think about xml or svg parser modules in python. The thread has a nifty script to get coordinates. I'm still trying to understand how to use it, so the nodes are elusive at the moment. Commented Mar 1, 2023 at 20:02

2 Answers 2


Inkscape has an extension that may be useful here. The extension is written in Python, so you may be able to modify it if you need more functionality. The extension file is located in the share\inkscape\extensions directory, and is named addnodes.py

Anyway . . .

If you draw a path with two nodes, and curves, click on Extensions > Modify Path > Add nodes, you can then add the nodes you want. There are two methods to do it: either by maximum segment length, or by number of segments.

enter image description here

If you then select a node, using the Edit Paths tool N - you can see the x,y co-oridnate of the selected node in the controls bar.

enter image description here

  • Indeed, this works for the curve above. I simply note that adding 40 nodes makes the d="m 53.0492... line in the svg file longer as the nodes are added. The nodetypes is unchanged (cc), yet there are three "smooth nodes" in with the remainder of "corner nodes". Just things to be aware of - very useful to work with further - perhaps when getting x,y coordinates from them in plain-text. Commented Mar 3, 2023 at 15:28
  • making the rounds - this is a good answer - didn't have a checkmark - but I figure it should be checkmarked, even if there are other checkmarks. Slowly I learn. Commented Mar 13, 2023 at 15:14

A way to get coordinates from svg:

Use this website. The website takes an svg file and outputs json or csv format x,y coordinates - e.g. to plot on a graph.

Another way to get coordinates from an svg file:

svg-path-interpolator. See this Stack Overflow post. One technical note : I had strange output when a shape such as a letter "G" had quadratic (q in the svg) parts of the path (I refrain from examples here). This Stack Overflow post suggests to try cairosvg input.svg -o output.svg which converts all quadratics q to cubics c. This discusses an example of how font can be affected by this issue, and this explains the mathematics relating cubic Bezier curves with quadratics.

Back to the example at hand :

Copy/paste the svg file of the example curve into the above website and follow instructions (the precise code above might be off - I have a number of these files laying around - it gets the idea across). Pay attention that the settings make no scale or translations calculations. The website allows a wide range of dots, I picked 40. The x/y coordinates are provided as plain text. Copy/paste, remove , and x,y. I wrote this awk script to make circles (red, radius 60, etc.) from the x y coordinates :

# make circles from coordinates
awk '{    x[NR] = $1 ; y[NR] = $2;  \

     printf ("    <circle\n")
     printf ("       style=\"fill:none;fill-opacity:0.25;stroke:\#ff0000;stroke-width:0.264999;stroke-opacity:1\"\n")
     printf ("       id=\"circle%2.0f\"\n", NR)
     printf ("       cx=\"%3.6f\"\n", x[NR])
     printf ("       cy=\"%3.6f\"\n", y[NR])
     printf ("       r=\"60\"/>\n")
}' $1

Copy/paste the output of svg circles into the original curve svg so the circles go between a id="defs2" /> and <g in this way :

<!-- begin svg file excerpt -->
     id="defs2" />
<!-- here comes example code of one of the circles --> 
<!--... lots more circles here not shown.. -->
     inkscape:label="Layer 1"
<,!-- end of svg file excerpt -->

There might be better ways to edit that.

Here is the result viewed in Inkscape :enter image description here

It is clear from clicking the circles that the centers line up precisely with the curve.

The svg-path-interpolator approach will also work - I might share some helpful scripts in the future.

This answer satisfies the question : how to get dots/points on a curve/line in an svg file into x,y coordinates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.