[Qgis-user] Problems with custom SVG images when transfering a project to another computer

Bernhard Seckinger bernhard.seckinger at bueffee.de
Tue Feb 25 01:04:54 PST 2025


Hi Stefan,

>have a look into the /QgsSvgCache /Class

I'm sorry, but I couldn't find anything useful there...


Meanwhile I worked out that if the saved geopackage contains the embedded SVG
the following line will produce a base64 string:

layer.renderer().rootRule().children()[0].symbol().symbolLayer(0).path()

If it is not embedded, it's the path to the SVG image. 

For me, this looks like I need to create the base64 version of the symbol and
probably use this in the constructor of QgsSvgMarkerSymbolLayer() instead of
the path. I havn't tried yet, because I need to figure out, how to create the
base64 version and unfortunately I've got other things to do for the rest of
today... I hope I'll find the time tomorrow.

I wonder if conversion to base64 is enough to embed the symbol in the project
file? My feeling says it isn't. Does anyone has some experience here?

Regards, Bernhard

PS: The question of how to embed SVG images was asked several times on stack
exchange and similiar places, but never answered...

--
Bernhard Seckinger <bernhard.seckinger at bueffee.de>


More information about the QGIS-User mailing list