SVG to PNG in plugin code - python

I am making a plugin and what I want to do is display a preview of image in widget. I have previews saved as SVG files. I found a way to show it in plugin window but I must convert them to PNG first. Is there any easy way to convert from SVG to PNG in python/pyqgis?

I found something about cairo, but I don't get how to use it in my plugin code. Anyone can help?

Replay

Use below code to use the cairo library

$ python3
import cairosvg
cairosvg.svg2pdf(url='image.svg', write_to='image.pdf')

reference : http://cairosvg.org/

Category: python Time: 2016-07-29 Views: 2

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.148 (s). 12 q(s)