SVG images not loading properly?

kawk kawk at theprogrammingsite.com
Tue Apr 1 18:18:41 EDT 2008


I'm not sure if this is the right place to ask, but anyhow. I have a bit
of a problem with SVG images in my Activity.

I have a collection of .SVG images I designed with Inkscape. They are
not saved in Inkscape .SVG, but "plain .SVG", according to Inkscape.

Now, I am attempting to load these aforementioned images via a function
that looks much like this:

def load_svg(name, width=card_width(), height=card_height()):

     svg = open(os.path.join('data', name)).read()
     load = svgsprite.SVGSprite(svg, size=(width, height))
     if load:
         rendered = load._render(width, height)
         pygame.image.save(rendered, os.path.join('data', name + '.tga'))
         return rendered
     else: return None


When I do so, I get mixed results. Some images partially load, but are
almost fully transparent, and are almost invisible. Others simply
produce a completely transparent image. I've attached two example
images, their .SVG files and .TGA rendered version.

Can anyone help me out with this? Am I doing something wrong?

Thanks.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: example1.svg
Type: image/svg+xml
Size: 1108 bytes
Desc: not available
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080401/eccd11ea/attachment.svg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example1.tga
Type: image/x-tga
Size: 1924 bytes
Desc: not available
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080401/eccd11ea/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example2.svg
Type: image/svg+xml
Size: 507 bytes
Desc: not available
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080401/eccd11ea/attachment-0001.svg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example2.tga
Type: image/x-tga
Size: 891 bytes
Desc: not available
URL: <http://lists.laptop.org/pipermail/devel/attachments/20080401/eccd11ea/attachment-0001.bin>


More information about the Devel mailing list