SVG to raster conversion.

Phil Thompson phil at riverbankcomputing.co.uk
Sun Sep 16 19:28:45 CEST 2007


On Sunday 16 September 2007, J. Cliff Dyer wrote:
> Does anybody know a good solution (preferably in python) for rasterizing
> SVG or other vector graphics.
>
> I'm thinking something like
>
> vector_image = SVGFile(path_to_image)
> raster_image = vector_image.rasterize(format, (width, height), dpi)
> raster_image.write(out_file)
>
> Thanks for any pointers you might have.

PyQt has QSVGRenderer (http://doc.trolltech.com/4.3/qsvgrenderer.html) which 
will render to a QPixmap (http://doc.trolltech.com/4.3/qpixmap.html) which 
you can save in a number of standard formats.

Phil



More information about the Python-list mailing list