SVG not showing

Hi, I’m trying to get a visualization of a simple SVG file but ofX is not rendering.
I have an svg file, with 860 polygons in it, not paths. is there an issue with svg polygons in ofX?

the code is very simple at this moment. getNumPath() is working. is giving me the correct answer, but it’s not rendering. what is the problem?

class ofApp : public ofBaseApp{

		void setup();
		void update();
		void draw();

		void keyPressed(int key);
		void keyReleased(int key);
		void mouseMoved(int x, int y );
		void mouseDragged(int x, int y, int button);
		void mousePressed(int x, int y, int button);
		void mouseReleased(int x, int y, int button);
		void mouseEntered(int x, int y);
		void mouseExited(int x, int y);
		void windowResized(int w, int h);
		void dragEvent(ofDragInfo dragInfo);
		void gotMessage(ofMessage msg);
        ofxSVG svg;
void ofApp::setup(){


void ofApp::draw(){

Hi, if you run ofxSVG’s example, can you get it to render anything?

yes. i used my svg on the example and it didn’t show anything either

I mean if you use the svg provided in the example? does it render?

the ofxSvg.h file states the following

/// ofxSVG is used for loading and rendering SVG files. It's a wrapper
/// for the open source C library [Libsvgtiny]( "Libsvgtiny website"),
/// and it supports files in the [SVG Tiny format]( "SVG Tiny 1.2
/// format specification at the W3C").
/// Libsvgtiny supports a subset of SVG elements, (for a full list, see the Libsvgtiny readme file)
/// but we have gone some way to improving this by manually implementing some extra features (such as the
/// SVG "use" element).

so you might want to check those links

the svg provided with the example renders perfectly. i’ve changed it for my svg and it didn’t render.
in this simple code i’ve posted, it renders the provided tiger but doesn’t render my bricks.

tiger.svg has all items as paths while my svg has them as polygons.


This is the format specification that should load properly

take a look at it.
There are some online tools for validating svg files. you might want to try these with your file.
How are you creating your svg file?

i’m originally doing it in illustrator. i’m checking it in inkscape and finally checking the code. it’s opening on browsers, it’s opening on processing. it’s not opening in ofx…

No idea then. Did you look at this ?

Are you exporting your SVG as an SVGTiny file from Illustrator? Can you upload the SVG to here? I’ll be happy to look into it.

I once had an issue with SVGs not appearing; discovered that the lineweights I was importing were less than 1.0 in width, and so for some reason the lines weren’t being imported when this was the case.

I have fixed this bug in the master branch but I don’t think it’s in the release yet. Here’s the commit details.

If you’re interested in why this happens, it’s because libsvgtiny stores the line weight as an integer(!)

Those are the settings i’m using exporting from illustrator. I’ve had the svg not displaying too when the advanced tick box where selected (illustrator ticks them by default).

I’m glad that’s working for you but it might be safer to use one of the SVG Tiny profiles in Illustrator, as the standard SVG format isn’t officially supported by libtinysvg.

1 Like

here’s the .svg file. i’ve done 5 different svgs. i’ll try the tiny option from illustrator

I saved it from Illustrator as SVGTiny and now it loads fine! Hope this helps.! download : tijolos2_path2|625x500

link not working, yet.

Sorry… Try this

it works.

what was the issue with the svg?


Nothing, I just saved it using the SVG Tiny 1.1 profile in Illustrator. Hope this helps!

ha yes I thought that about the int store. I wrote my own workaround ages back but never recorded it