Skip to main content
Participating Frequently
April 12, 2024
Question

Extracting SVG Coordinates for AE Script

  • April 12, 2024
  • 1 reply
  • 253 views

I am needing to extract SVG coordinates for a script that I am running in After Effects. I have created an icon in illustrator, saved it as an SVG and pulled this string from it:

["M0,64.31V30.34L32.36,0l32.37,30.37v33.95H0Z"]

The script I am using is requires that the SVG coordinates be in this format:
["21.32 9.44 26.33 8.84 22.26 11.25 24.93 16.40 33.72 16.40 38.68 11.99 34 10.06 33.59 12.99 30 11.25 32.02 8.82 36.36 8.84 47 13 36 21 21 21 13 13 20 4 38 2 47 13 44.10 12.62 37.13 4.10 21.04 5.92 16.91 11.32"]

Is there anyway to get a string of coordinates from an SVG that will follow the format above?

Here is a link to the script: https://github.com/adamplouff/scriptui-battlestyle/tree/master
This topic has been closed for replies.

1 reply

Mylenium
Legend
April 12, 2024

One are just object coordinates, the other are appear to be path points. None of this bears any relation to the other per se. Unless you expand the appearance in AI to actually get access to the paths you can't do anything with it. Conversely, the coordinates would need to be set in pixels on export, not AI's default inches and of course you may need to consider DPI, art board origin etc. To get usable values. None of this has to do with the actual coding. You need to prepare your artwork suitably.

 

Mylenium