SVG files


I have been using Defold for a while and my graphics in Photoshop look great but when I import them I keep getting scaling issues. I would like to know if Defold accepts SVG files so that I can scale however I want.


What kind of scaling issues are you seeing?

SVG are not supported.


Just in general I am wondering what the best practices are for size of game in game.project. Right now I have it set to 640/1440 with High DPI on. I have no idea what I should set those to. Also, if a phone with a different resolution than that logs on, how will it scale or will it change the size of the game world?


We will create a new manual to better try to cover these questions. In general you can say that it depends a bit on how what kind of game you are creating. Have you read these posts:


Hi. Any chance of supporting SVGs in the future?


I saw someone made an SVG importer for point data somewhere… there is probably a rasterizer out there which someone could make into a native extension for loading SVG image data into buffers for display.


Yes, via native extensions :slight_smile:

There was a new image loader extension announced recently, perhaps it also supported SVG (unlikely)?


@sergey.lerg maybe look at adapting this like you did with stb_image.h?


Nanosvg is not good enough, it produces bad results barely useable.


I think we need a lot more work done to support custom texture formats in the engine (i.e. rendering actual vector graphics).

If not, we’re talking about rasterising the texture. And unless you have tough gradients in the texture, a large texture will compress quite well. And, you can scale it down to the lower resolutions.

That said, yes, you can rasterise it in a native extension.


Supporting vector formats would be great especially for user interface assets.


I don’t see many better options.

A nanosvg version may still be useful to some as a starting point. Just having a functional vector rasterizer for Defold would be cool.