Can't get outlines from an svg

Hi!

I’m trying to get the outlines from a simple svg but it just doesnt work. Do the files have to be in a special format? The tiger.svg in the examples works without any problems but I cant get others to work. Tried this image https://www.onlinewebfonts.com/icon/558896 but i just get the warning " need at least 3 points".

Many many thanks!

Hi there!

openFrameworks uses the libsvgtiny library to parse svgs, and unfortunately it doesn’t support all formats of SVG. You’ll need to convert your file to “svg tiny” format - you can use illustrator or Inkscape to do this.

hope this helps!

Seb

1 Like

heyho,
you could try to run it through an optimiser, maybe that helps.
svgo usually does a good job: https://github.com/svg/svgo

also validating if it is proper xml and svg cannot hurt: https://validator.w3.org/

1 Like

Fixed it by changing to a smaller svg format witch I think was tinysvg and making sure it was exported with lines. It was just a filled shape before that.

1 Like

You should get the outlines for filled shapes but glad it worked out either way

1 Like

I’m a little hazy on this but I think in the past I’ve had issues getting outlines from filled shapes from SVG if the winding order is different than normal – I don’t know if that’s set in the SVG or not but I’ve def had to muck around with the winding order on ofPath object to get it to return polylines – see the getOutline function here to see where it returns polylines only if winding mode is OF_POLY_WINDING_ODD:

2 Likes