SVG to raster conversion.

BJörn Lindqvist bjourne at gmail.com
Mon Sep 17 05:16:06 EDT 2007


On 9/16/07, J. Cliff Dyer <jcd at sdf.lonestar.org> 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.

Use rsvg:

import rsvg
h = rsvg.Handle('svg-file.svg')
pixbuf = h.get_pixbuf()
pixbuf.save('foobar.png', 'png')

-- 
mvh Björn



More information about the Python-list mailing list